Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to grant system permissions to my android app?

I'm implementing a demo on silently uninstall an app from device.

In adb shell, I can use pm uninstall packagename to do the task, but when I wrote code, I got some permission denied error.

I've been googling for a while, and found that to get DELETE_PACKAGES permission, I have to sign my app with the same certificate as the system does.

So, can anyone give me some tips on how to do this? Or, is there anyway I can do to make my app running as system service?

like image 339
Void Main Avatar asked Mar 16 '12 02:03

Void Main


2 Answers

You can't do this, unless you are building your own firmware (ROM). If you are, just take the key that signs the ROM and sign your apk with it. If you have a rooted phone, you can also copy the apk in /system/app to get the permission.

like image 106
Nikolay Elenkov Avatar answered Oct 19 '22 05:10

Nikolay Elenkov


Far better than a silent uninstall is somehow bricking the app. There's a few ways that this could be done, but basically keep track of the first day they used it, and make the program not work. Alternatively, it could be set up to work until a certain day, after which it will no longer work. This question answers how to do this.

like image 26
PearsonArtPhoto Avatar answered Oct 19 '22 06:10

PearsonArtPhoto