Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code to enable a setting of Android developer mode [duplicate]

Tags:

android

I want to make a code to enable the developer mode and set a parameter on this ( the one to always allow roaming detection so we can switch to a better wifi if found).

I saw some apps that can launch developer mode, but nothing is opening it AND changing some parameters. I can't ask to users to set this parameter themselves, so how can I make this myself?

I saw also that we can do this by shell :

adb shell am start -n com.android.settings/.DevelopmentSettings

But afterwards i don't know how to set automatically a parameter.

As I made my own app, I could launch developer mode and this param on the start of my app.

Did anyone made this before inside of an app? How can I call DevelopmentSettings activity inside my app and edit some of its parameters?

Thanks

EDIT

I can eventually root all my phones and set my app inside system folder, It can be complicated but we could manage it. If I does, How can I access to the parameters of developer mode programatically?

like image 215
Nicolas D Avatar asked May 10 '26 19:05

Nicolas D


1 Answers

You can use following code but you need root access for this.

.Settings.Secure.putInt(getActivity().getContentResolver(),Settings.Secure.ADB_ENABLED, 1);

For More information Check this link : How to access device settings programmatically?

Thanks

like image 193
Sharanjeet Kaur Avatar answered May 12 '26 10:05

Sharanjeet Kaur