Enable USB debugging (under settings/applications/development) programmatically from within an app

后端 未结 5 1226
北海茫月
北海茫月 2020-12-11 03:23

Is it possible to enable USB debugging (under settings/applications/development) programmatically from within my app?

I was looking at Permission.WRITE_SETTING

5条回答
  •  暖寄归人
    2020-12-11 03:49

    First: Your app must be a system app

    This line of code may help:

    Settings.Global.putInt(getContentResolver(), Global.ADB_ENABLED, 1);

    and you need this permission:

    but after adding this permission in manifest you will get this error: Permission is only granted to system apps

    which means your app must be a system app.

提交回复
热议问题