Android: add the application to the firmware, use WRITE_SECURE_SETTINGS

I am trying to write an application that can enable and disable my mobile data connection. Already got the source and built my own sdk where I removed the @hide statements so that I can use the corresponding function

cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
cm.setMobileDataEnabled(true);

It also turns out what permissions I need, in particular WRITE_SECURE_SETTINGS, which are available only for system applications. I read adamk's comment and now I need to know how to do what he suggested (add the application to the system or sign it using the platform key).

At first, I would like to do this only on the emulator, and then on my phone (which is implemented and used by custom ROM). I tried pushing it into the emulator system directory:

adb remount
adb push app.apk /system/app/
adb sync

, .

? ?

+3
1

, , , . :

adb remount
adb push app.apk /system/app/

( adb sync). , .apk , , . .apk , , , - , . ( ClockworkMod): , /system folder USB-. , , , . , -, .

+3

Source: https://habr.com/ru/post/1762991/


All Articles