Android 23 – 从备份中排除GCM注册ID

我有一个使用Azure发送推送通知的应用程序. Azure依次使用GCM发送到 Android设备.

我注意到我的AndroidManifest.xml中有一个警告说明

On SDK version 23 and up,your app data will be automatically backed
up,and restored on app install. Your GCM regid will not work across
restores,so you must ensure that it is excluded from the back-up set.
Use the attribute android:fullBackupContent to specify an @xml
resource which configures which files to backup.

我按照https://developer.android.com/training/backup/autosyncapi.html?hl=in#configuring的说明进行操作

但是我对如何从备份中排除GCM regID感到难过?这是我目前的设置.

表现

<application
        android:allowBackup="true"
        android:fullBackupContent="@xml/backup_scheme"
        ........

RES / XML / backup_scheme.xml

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <exclude domain="sharedpref" path=""/>
</full-backup-content>

我把什么作为路径?我应该在某个地方放置一个物理文件吗?

UPDATE

所以我想我弄明白了.在我的RegistrationIntentService.java文件中,我将用户registrationID存储在字符串“registrationID”下的共享首选项中.所以我假设我使用以下内容……

<exclude domain="sharedpref" path="registrationID"/>

对?

解决方法

所以我明白了.在我的RegistrationIntentService.java文件中,我将用户registrationID存储在字符串“registrationID”下的共享首选项中.所以在backup_scheme.xml文件中使用以下内容……
<exclude domain="sharedpref" path="registrationID"/>

相关文章

AdvserView.java package com.earen.viewflipper; import an...
ImageView的scaleType的属性有好几种,分别是matrix(默认)...
文章浏览阅读8.8k次,点赞9次,收藏20次。本文操作环境:win1...
文章浏览阅读1.2w次,点赞15次,收藏69次。实现目的:由main...
文章浏览阅读3.8w次。前言:最近在找Android上的全局代理软件...
文章浏览阅读2.5w次,点赞17次,收藏6次。创建项目后,运行项...