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

北城余情 提交于 2019-12-10 10:03:04

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/15006929/when-i-add-android-permission-update-device-stats-to-my-app-error-occur

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!