ji ding
ji ding

Reputation: 61

when I add android.permission.UPDATE_DEVICE_STATS to my app.error occur

I developed an app which needs to get the android.permission.UPDATE_DEVICE_STATS permission. However, when I add this permission to my app's AndroidMainfest.xml file, I get this error:

"Permission is only granted to system apps"

What can I do to change my app to system app? Are there any other ways to solve this problem?

Upvotes: 3

Views: 4832

Answers (2)

Timmetje
Timmetje

Reputation: 7694

Most importantly to know: A system app can only be run by people who have rooted their device. Meaning you can't test and run your own application if you don't have a rooted device.

You can declare your app to run as a system app by setting the sharedUserId as follows in the AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="[your package name]"
        android:sharedUserId="android.uid.system">

Otherwise you have to sign your application with system key , see this thread How to compile Android Application with system permissions

Upvotes: 3

CommonsWare
CommonsWare

Reputation: 1006664

what can I do to change my app to system app.

Build your own firmware (i.e., ROM mod) and sign your app with the same signing key as you used with that firmware.

Or, since this is a signature-or-system permission, you can root your device and install the APK on the system partition.

Upvotes: 0

Related Questions