2

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?

Nicolas D
  • 1,182
  • 18
  • 40
  • 1
    That would be a breach of security. – nhaarman Nov 23 '16 at 11:17
  • Excepted if user is informed that we do that. I don't mind to tell this to user, as it is only for an intranet application – Nicolas D Nov 23 '16 at 11:18
  • 1
    Check this link http://stackoverflow.com/questions/18782546/can-we-programatically-enable-disable-usb-debugging-on-android-devices Thanks. – Sharanjeet Kaur Nov 23 '16 at 11:21
  • 6
    Check this link : http://stackoverflow.com/questions/11985251/how-to-access-device-settings-programmatically Thanks – Sharanjeet Kaur Nov 23 '16 at 11:23
  • @SharanjeetKaur I saw in your first link that for security parameters it is complicated to do this for an unsigned app on a non rooted device, so it is looking probably bad for developer mode settings... thanks for the info, not especially what I asked but quite related! – Nicolas D Nov 23 '16 at 11:28
  • @Nicholas D Hi, May be this link will help you :) http://stackoverflow.com/questions/11985251/how-to-access-device-settings-programmatically – Sharanjeet Kaur Nov 23 '16 at 11:58
  • @SharanjeetKaur please put this in normal answer, I will accept it as solution to my issue! Thanks for your investigation! – Nicolas D Nov 23 '16 at 12:10

1 Answers1

4

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

Community
  • 1
  • 1
Sharanjeet Kaur
  • 796
  • 13
  • 18
  • @TimCastelijns Something weird happened here; the answerer has comments on the question, despite having only 1 point. I'm guessing the answerer used answers to comment. And that these answers were converted to comments. But probably got an answer block from having too many deleted answers. – S.L. Barth is on codidact.com Nov 23 '16 at 12:23
  • @Sharanjeet Kaur: link-only answers are discouraged. You may want to [edit] your answer further, so that it will still be useful if the link dies. Also, please tell me - how were you able to post comments on the question? Did you use the "answer" box to post the comments? – S.L. Barth is on codidact.com Nov 23 '16 at 12:32