/// <summary> /// 检测apk版本,确认是否需要强制更新 /// </summary> /// <returns> false:需要强更; true:不需要强更 </returns> private static bool CheckAPKVersion() { string url = ServerInfoConfig.GetApkURL(); if (string.IsNullOrEmpty(url)) { return(true); } url += "?sign=" + SDK.GetInstance().GetBundleID() + "&game=" + ServerInfoConfig.GetGame(); string result = HttpUtil.Get(url); if (string.IsNullOrEmpty(result)) { return(true); } ApkVersionInfo versionInfo = JsonFx.Json.JsonReader.Deserialize <ApkVersionInfo>(result); if (null == versionInfo) { return(true); } int toVersion = Util.ParseVersion(versionInfo.version); int curVersion = Util.ParseVersion(ServerInfoConfig.GetVersion()); if (curVersion < toVersion) { UpdateNoticePanel.Show(versionInfo.notice, () => { Application.OpenURL(versionInfo.url); }); return(false); } return(true); }
private static void CaptureLog(string condition, string stacktrace, LogType type) { if (type == LogType.Error) { errorDict.Clear(); string url = ServerInfoConfig.GetErrorURL(); if (string.IsNullOrEmpty(url)) { return; } errorDict.Add("msg", condition + "\n" + stacktrace); errorDict.Add("game", ServerInfoConfig.GetGame()); errorDict.Add("environment", "android"); string deviceID = ""; //string deviceID = SystemInfo.deviceUniqueIdentifier; if (!string.IsNullOrEmpty(deviceID)) { errorDict.Add("deviceId", deviceID); } string deviceName = ""; if (!string.IsNullOrEmpty(deviceName)) { errorDict.Add("deviceName", deviceName); } string platform = "jzwl"; if (!string.IsNullOrEmpty(platform)) { errorDict.Add("platform", platform); } string accountName = ""; if (!string.IsNullOrEmpty(accountName)) { errorDict.Add("account", accountName); } string accountTicket = ""; if (!string.IsNullOrEmpty(accountName)) { errorDict.Add("ticket", accountTicket); } long playerId = 0; if (playerId != 0) { errorDict.Add("playerId", playerId.ToString()); } if (errorDict != null && errorDict.Count > 0) { string reqUrl = url + "?"; foreach (KeyValuePair <string, string> post_arg in errorDict) { reqUrl += post_arg.Key + "=" + WWW.EscapeURL(post_arg.Value, System.Text.Encoding.UTF8) + "&"; } reqUrl = reqUrl.Remove(reqUrl.Length - 1); try { System.Net.WebRequest wReq = System.Net.WebRequest.Create(reqUrl); System.Net.WebResponse wResp = wReq.GetResponse(); wResp.GetResponseStream(); } catch (System.Exception) { //errorMsg = ex.Message; } } } }