Aldridge1991
Aldridge1991

Reputation: 1367

Toggle DEVELOPMENT_SETTINGS_ENABLED Android

this is what I'm trying to do

Settings.Global.putInt(my_context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);

but it's not working. My app is a system/app and has WRITE_SECURE_SETTINGS permission.

Thanks a lot

EDIT: For example, this code below is working fine:

Settings.Global.putInt(my_context.getContentResolver(), Settings.Global.ADB_ENABLED, 0);

Upvotes: 1

Views: 3020

Answers (1)

Aldridge1991
Aldridge1991

Reputation: 1367

To enable developer settings:

Settings.Secure.putInt(my_context.getContentResolver(), Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Global.putInt(my_context.getContentResolver(), Settings.Global.ADB_ENABLED, 1);

To disable developer settings:

Settings.Secure.putInt(my_context.getContentResolver(), Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0);
Settings.Global.putInt(my_context.getContentResolver(), Settings.Global.ADB_ENABLED, 0);

Upvotes: 2

Related Questions