Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open/change Google Ads opt out setting programmatically in Android?

Is there an easy way to help users to change their Opt out of Ads Personalization setting from within an app?

It can be opened manually from the Android Settings app by browsing to Google -> Ads:

ads_opt_out

I know lots of the Settings screen can be opened programmatically using the Settings class, e.g.

Intent intent = new Intent(Settings.ACTION_NFC_SETTINGS);
activity.startActivity(intent);

However, I can't see an option for opening the Ads screen.

I also know that Google Play Services has some helpful utilities to let a user adjust their Location settings, e.g. LocationSettingsRequest.

Is there anything similar for the Ads settings?

like image 583
Dan J Avatar asked Oct 19 '22 00:10

Dan J


1 Answers

For those who are still looking for the solution. You can simply create the action string and pass that into intent.

For Example:

String action = "com.google.android.gms.settings.ADS_PRIVACY";
Intent settings = new Intent(action);
startActivity(settings);

This will open the Ads setting page.

like image 73
Narendra Pal Avatar answered Oct 27 '22 10:10

Narendra Pal