/// <summary> /// Puts the value of a key in dataset. If a new value is assigned to the /// key, the record is marked as dirty. If the value is null, then the record /// is marked as deleted. The changed record will be synced with remote /// storage. /// </summary> /// <param name="identityId">Identity identifier.</param> /// <param name="datasetName">Dataset name.</param> /// <param name="key">record key.</param> /// <param name="value">string value. If null, the record is marked as deleted.</param> public void PutValue(string identityId, string datasetName, string key, string value) { lock (sqlite_lock) { bool result = PutValueHelper(identityId, datasetName, key, value); if (!result) { _logger.DebugFormat("{0}", @"Cognito Sync - SQLiteStorage - Put Value Failed"); } else { UpdateLastModifiedTimestamp(identityId, datasetName); } } }
/// <summary> /// Init this instance. This methods needs to be called from the main thread, Otherwise the values may not initialize correctly /// </summary> public void Init() { PersistentDataPath = Application.persistentDataPath; #if UNITY_ANDROID && !UNITY_EDITOR //device related information AndroidJavaClass buildJavaClass = new AndroidJavaClass("android.os.Build"); AndroidJavaClass versionJavaClass = new AndroidJavaClass("android.os.Build$VERSION"); PlatformVersion = versionJavaClass.GetStatic <string>("RELEASE"); Model = buildJavaClass.GetStatic <string>("MODEL"); Make = buildJavaClass.GetStatic <string>("MANUFACTURER"); AndroidJavaClass localeClass = new AndroidJavaClass("java.util.Locale"); AndroidJavaObject localeObject = localeClass.CallStatic <AndroidJavaObject>("getDefault"); Locale = localeObject.Call <string>("toString"); Platform = Application.platform.ToString(); //application related information AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentContext = unityPlayerClass.GetStatic <AndroidJavaObject>("currentActivity"); PackageName = currentContext.Call <string>("getPackageName"); AndroidJavaObject packageManager = currentContext.Call <AndroidJavaObject>("getPackageManager"); AndroidJavaObject packageinfo = packageManager.Call <AndroidJavaObject>("getPackageInfo", PackageName, 0); AndroidJavaObject applicationInfo = packageManager.Call <AndroidJavaObject>("getApplicationInfo", PackageName, 0); VersionCode = System.Convert.ToString(packageinfo.Get <int>("versionCode")); VersionName = packageinfo.Get <string>("versionName"); Title = packageManager.Call <string>("getApplicationLabel", applicationInfo); #elif UNITY_IOS && !UNITY_EDITOR //platform related information Platform = Application.platform.ToString(); Locale = locale(); PlatformVersion = SystemInfo.operatingSystem; Make = "apple"; #if UNITY_5 if (UnityEngine.iOS.Device.generation.ToString().StartsWith("iPhone")) { Model = "iPhone"; } else if (UnityEngine.iOS.Device.generation.ToString().StartsWith("iPad")) { Model = "iPad"; } else { Model = "iPod"; } #else if (iPhone.generation.ToString().StartsWith("iPhone")) { Model = "iPhone"; } else if (iPhone.generation.ToString().StartsWith("iPad")) { Model = "iPad"; } else { Model = "iPod"; } #endif //Application related information Title = title(); VersionCode = versionCode(); VersionName = versionName(); PackageName = packageName(); #else Platform = Application.platform.ToString(); if (Thread.CurrentThread.CurrentCulture != CultureInfo.InvariantCulture) { Locale = Thread.CurrentThread.CurrentCulture.Name; } else { Locale = Application.systemLanguage.ToString(); } PlatformVersion = SystemInfo.operatingSystem; Model = SystemInfo.deviceModel; Make = ""; #endif _logger.DebugFormat("make = {0}", Make); _logger.DebugFormat("model = {0}", Model); _logger.DebugFormat("platform version = {0}", PlatformVersion); _logger.DebugFormat("locale = {0}", Locale); _logger.DebugFormat("Title = {0}", Title); _logger.DebugFormat("Version Code = {0}", VersionCode); _logger.DebugFormat("Version Name = {0}", VersionName); _logger.DebugFormat("Package Name = {0}", PackageName); }