Java Code Examples for com.google.ads.consent.ConsentInformation#getInstance()
The following examples show how to use
com.google.ads.consent.ConsentInformation#getInstance() .
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: 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 3
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); } }); } }
Example 4
Source File: ConsentManager.java From callmeter with GNU General Public License v3.0 | 6 votes |
private boolean checkConsentForAds() { final ConsentInformation consentInformation = ConsentInformation.getInstance(mActivity); if (!consentInformation.isRequestLocationInEeaOrUnknown()) { Log.d(TAG, "User is outside EEA"); return true; } final ConsentStatus consentStatus = consentInformation.getConsentStatus(); Log.d(TAG, "ConstentStatus: ", consentStatus); if (ConsentStatus.UNKNOWN.equals(consentStatus)) { Log.d(TAG, "Need to ask for consent"); // we need to ask for consent askForConsent(); return false; } return true; }
Example 5
Source File: ConsentManager.java From callmeter with GNU General Public License v3.0 | 5 votes |
public boolean needConsent() { final ConsentInformation consentInformation = ConsentInformation.getInstance(mActivity); if (!consentInformation.isRequestLocationInEeaOrUnknown()) { Log.d(TAG, "User is outside EEA"); return false; } else { return true; } }
Example 6
Source File: ConsentManager.java From UpdogFarmer with GNU General Public License v3.0 | 4 votes |
private void setupConsentInfo() { consentInfo = ConsentInformation.getInstance(context.getApplicationContext()); }