private void CheckConsentStatus() { adProviderList = new List <AdProvider>(); Consent consentInfo = Consent.GetInstance(this); consentInfo.AddTestDeviceId("********"); consentInfo.SetDebugNeedConsent(DebugNeedConsent.DebugNeedConsentField); consentInfo.RequestConsentUpdate(this); }
/// <summary> /// Check consent status. /// </summary> private void CheckConsentStatus() { Consent consentInfo = Consent.GetInstance(this); // To ensure that a dialog box is displayed each time you access the code demo, set ConsentStatus to UNKNOWN. In normal cases, the code does not need to be added. consentInfo.SetConsentStatus(ConsentStatus.Unknown); string testDeviceId = consentInfo.TestDeviceId; consentInfo.AddTestDeviceId(testDeviceId); // After DebugNeedConsent is set, ensure that the consent is required even if a device is not located in a specified area. consentInfo.SetDebugNeedConsent(DebugNeedConsent.DebugNeedConsentField); consentInfo.RequestConsentUpdate(this); }
/// <summary> /// Update the consent status. /// </summary> /// <param name="consentStatus"></param> private void UpdateConsentStatus(ConsentStatus consentStatus) { Consent.GetInstance(context).SetConsentStatus(consentStatus); //Save a user selection to the local SP. ISharedPreferences sharedPreferences = context.GetSharedPreferences(AdsConstant.SpName, FileCreationMode.Private); ISharedPreferencesEditor editor = sharedPreferences.Edit(); editor.PutInt(AdsConstant.SpConsentKey, consentStatus.Value).Commit(); //Callback activity if (callback != null) { callback.UpdateConsentStatus(consentStatus); } }