简体   繁体   中英

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?

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.

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.

If your application is not located at "/system/app",permission "DELETE_PACKAGES" would not work. Compile your app with source code or try "root" ;)

I have experience about how get one application permission to read browser bookmark

  1. Open the AndroidManifest.xml of That application that you want to add permission to it.

2.Somewhere between

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
</manifest> 

add this code

<uses-permission android:name="..." />

3.For fill the ... go here For example the following code will permit to app to get bookmark history

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM