I have implemented the "old" GCM implementation where the sample code had the following:
public static final String PROPERTY_REG_ID = "registration_id";
private SharedPreferences getGCMPreferences(Context context) {
return context.getSharedPreferences(SampleApp.class.getSimpleName(),
Context.MODE_PRIVATE);
}
...
String registrationId = prefs.getString(PROPERTY_REG_ID, "");
With the new backup system in Android 6.0 it says you should exclude this key but the exclude format docs: http://developer.android.com/training/backup/autosyncapi.html
doesn't really seem to indicate how you can exclude a sharedpreference except saying that:
sharedpref: Specifies a SharedPreferences object that the getSharedPreferences() method returns.
There isn't a getSharedPreferences() with no parameters to my knowledge?
I tried:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="sharedpref" path="registration_id"/>
</full-backup-content>
But that didn't seem to work naturally since I haven't indicated which sharedpreference file it should exclude from. Anyone successfully implemented this?