Created
March 8, 2022 11:44
-
-
Save Mirkoddd/40c90bc9fb093f24d29acb8b595d33b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean canShowAds(Context context){ | |
prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); | |
String purposeConsent = prefs.getString("IABTCF_PurposeConsents", ""); | |
String vendorConsent = prefs.getString("IABTCF_VendorConsents",""); | |
String vendorLI = prefs.getString("IABTCF_VendorLegitimateInterests",""); | |
String purposeLI = prefs.getString("IABTCF_PurposeLegitimateInterests",""); | |
int googleId = 755; | |
boolean hasGoogleVendorConsent = hasAttribute(vendorConsent, googleId); | |
boolean hasGoogleVendorLI = hasAttribute(vendorLI, googleId); | |
List<Integer> indexes = new ArrayList<>(); | |
indexes.add(1); | |
List<Integer> indexesLI = new ArrayList<>(); | |
indexesLI.add(2); | |
indexesLI.add(7); | |
indexesLI.add(9); | |
indexesLI.add(10); | |
return hasConsentFor(indexes, purposeConsent, hasGoogleVendorConsent) | |
&& hasConsentOrLegitimateInterestFor(indexesLI, purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment