Unclear SecurityException when using Android Service Backup (Cloud Backup)

喜夏-厌秋 提交于 2019-12-05 16:10:32

Official Android documentation of Manifest permissions knows nothing about permission

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

So, you should remove it from your Manifest. Android Backup Service doesn't require additional permissions.

However, specified permission can be used, but only by "system" applications, because it requires PROTECTION_SIGNATURE or PROTECTION_SIGNATURE_OR_SYSTEM level of permissions.

Such permission needed only when calling method BackupManager.dataChanged(String packageName), but usually this method is not needed when implementing Backup Service.

Hayes Haugen

The android.permission.BACKUP permission is not needed for normal BackupAgent operations. Remove it from your manifest - though it shouldn't stop your BackupAgent from working.

Make sure to call BackupManager.dataChanged() method when you need to do a backup otherwise your BackupAgent will be called once but never again. It does not need android.permission.BACKUP either.

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