Created
March 8, 2022 11:51
-
-
Save Mirkoddd/2840e7adcfbe8a064472d1a8807f47a3 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 canShowPersonalizedAds(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); | |
indexes.add(3); | |
indexes.add(4); | |
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