I implemented the "old" GCM implementation, where the example 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 that you should exclude this key, but exclude format documents: http://developer.android.com/training/backup/autosyncapi.html
doesn't actually indicate how you can exclude sharedpreference, except that:
sharedpref: indicates a SharedPreferences object that returns the getSharedPreferences () method.
Is there no getSharedPreferences () without any parameters that I know of?
I tried:
<?xml version="1.0" encoding="utf-8"?> <full-backup-content> <exclude domain="sharedpref" path="registration_id"/> </full-backup-content>
But this does not seem to work fine, since I did not indicate which sharedpreference file it should exclude. Has anyone successfully implemented this?
android-6.0-marshmallow android-backup-service
Christer nordvik
source share