com.google.ads.consent.ConsentInfoUpdateListener Java Examples
The following examples show how to use
com.google.ads.consent.ConsentInfoUpdateListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConsentSDK.java From GDPR-Admob-Android with MIT License | 6 votes |
private void initConsentInformation(final ConsentInformationCallback callback) { final ConsentInformation consentInformation = ConsentInformation.getInstance(context); if(DEBUG) { if(!DEVICE_ID.isEmpty()) { consentInformation.addTestDevice(DEVICE_ID); } consentInformation.setDebugGeography(DebugGeography.DEBUG_GEOGRAPHY_EEA); } String[] publisherIds = {publisherId}; consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() { @Override public void onConsentInfoUpdated(ConsentStatus consentStatus) { if(callback != null) { callback.onResult(consentInformation, consentStatus); } } @Override public void onFailedToUpdateConsentInfo(String reason) { callback.onFailed(consentInformation, reason); } }); }
Example #2
Source File: ConsentManager.java From UpdogFarmer with GNU General Public License v3.0 | 6 votes |
/** * Request user consent status */ public void requestConsentInfo() { final String[] publisherIds = {"pub-6413501894389361"}; consentInfo.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() { @Override public void onConsentInfoUpdated(ConsentStatus consentStatus) { // User's consent status successfully updated. handleConsent(consentStatus); } @Override public void onFailedToUpdateConsentInfo(String reason) { Log.i(TAG, "Consent status failed to update. Reason: " + reason); } }); }
Example #3
Source File: EuConsent.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
static public void check(final Context context) { if (getConsentLevel() < NON_PERSONALIZED) { final ConsentInformation consentInformation = ConsentInformation.getInstance(context); String[] publisherIds = {Game.getVar(R.string.admob_publisher_id)}; consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() { @Override public void onConsentInfoUpdated(ConsentStatus consentStatus) { if (!ConsentInformation.getInstance(context).isRequestLocationInEeaOrUnknown()) { setConsentLevel(PERSONALIZED); } } @Override public void onFailedToUpdateConsentInfo(String errorDescription) { EventCollector.logException(errorDescription); } }); } }
Example #4
Source File: ConsentManager.java From callmeter with GNU General Public License v3.0 | 6 votes |
public void updateConsent() { if (!DonationHelper.hideAds(mActivity)) { ConsentInformation consentInformation = ConsentInformation.getInstance(mActivity); String[] publisherIds = {ADMOB_PUBLISHER_ID}; consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() { @Override public void onConsentInfoUpdated(final ConsentStatus consentStatus) { Log.i(TAG, "updated consent status: ", consentStatus.toString()); checkConsentForAds(); } @Override public void onFailedToUpdateConsentInfo(final String errorDescription) { Log.e(TAG, "failed to update consent info: ", errorDescription); } }); } }