Esempio n. 1
0
        // https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID
        /// <summary>
        /// A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device.
        /// The value may change if a factory reset is performed on the device.
        /// </summary>
        /// <returns>The unique identifier of the device.</returns>
        public static string GetAndroidId()
        {
            if (AGUtils.IsNotAndroidCheck())
            {
                return(string.Empty);
            }

            try
            {
                using (var objResolver = AGUtils.Activity.CallAJO("getContentResolver"))
                {
                    using (var clsSecure = new AndroidJavaClass("android.provider.Settings$Secure"))
                    {
                        string ANDROID_ID = clsSecure.GetStaticStr("ANDROID_ID");
                        string androidId  = clsSecure.CallStaticStr("getString", objResolver, ANDROID_ID);
                        return(androidId);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogWarning("Failed to get Android Id, reasong: " + e.Message);
                return(string.Empty);
            }
        }
 public static string InsertImage(Texture2D texture2D, string title, string description)
 {
     using (var mediaClass = new AndroidJavaClass(C.AndroidProviderMediaStoreImagesMedia))
     {
         using (var cr = AGUtils.ContentResolver)
         {
             var image    = AGUtils.Texture2DToAndroidBitmap(texture2D);
             var imageUrl = mediaClass.CallStaticStr("insertImage", cr, image, title, description);
             return(imageUrl);
         }
     }
 }
Esempio n. 3
0
 public string GetNativeSdkVersion()
 {
     return(_getSocial.CallStaticStr("getSdkVersion"));
 }
Esempio n. 4
0
 public string GetPublicProperty(string key)
 {
     return(_user.CallStaticStr("getPublicProperty", key));
 }