private string GetAdvertiserID() { string id = null; var cr = Application.Context.ContentResolver; // If do not track is on return empty advertiser id if (this.GetDoNotTrack() == 1) { return("00000000-0000-0000-0000-000000000000"); } // First try to get the advertising_id (from on FireTV) if available try { id = Android.Provider.Settings.Secure.GetString(cr, "advertising_id"); } catch {} // Next use android_id if available if (string.IsNullOrWhiteSpace(id)) { try { id = Android.Provider.Settings.Secure.GetString(cr, Android.Provider.Settings.Secure.AndroidId); } catch {} } // Next use Serial if available (exists on API Level 9) if (string.IsNullOrWhiteSpace(id)) { id = Build.Serial; } // Finally if we still don't have an ad id generate a uuid and save it to file. if (string.IsNullOrWhiteSpace(id)) { id = SaveDataHandler.LoadData(AndroidAds.CustomGUIDSavePath); if (string.IsNullOrWhiteSpace(id)) { id = Guid.NewGuid().ToString(); SaveDataHandler.SaveData(id, AndroidAds.CustomGUIDSavePath); } } return(id); }
protected void SaveCurrentAdTime(int time) { SaveDataHandler.SaveData(time.ToString(), Ads.AdTimeSavePath); }