24

What does this Lint warning mean:

Should explicitly set 'android:fullBackupContent' to avoid backing up the GCM device specific regId?

I've googled but haven't found anything yet.

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
  • Interestingly, this warning appears [even if allowBackup is false](http://stackoverflow.com/q/31767619/145173). – Edward Brey Aug 02 '15 at 00:51

3 Answers3

16

Part of the disturbing "auto backup for apps" is the ability to control what files get backed up, via android:fullBackupContent. That attribute points to an XML resource (e.g., @xml/backup_rulez), that describes either a whitelist or a blacklist controlling what gets backed up.

What the Lint warning is warning you about is not backing up the GCM registration ID, as that is per-device, and so it would need to be re-generated if your app's data is restored from the backup onto a new device. Personally, off the top of my head, I don't know where GCM is storing that registration ID.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
5

CommonsWare is correct. However, GCM does not store that regid for you - The GCM quickstarter used to suggest (it has since been updated) that you store it yourself in a shared prefs file. The lint rule is detecting that you have declared a receiver for GCM and therefore assumes that you are stashing the regid somewhere. Because you haven't declared a fullBackupContent flag in your manifest it is warning you that your app will likely break across restore. You use the fullBackupContent to exclude or include whatever data you would like to not leave the device and be restored on another device (gcm instance id token is one example)

more details here

43matthew
  • 962
  • 8
  • 14
2

Let me be more specific here, regarding the Lint warning.

As mentioned in the Known Issues with the automatic backup service:,

backing up the registration ID returned by Google Cloud Messaging registration can break push notifications for the restored app

So it is advised to exclude the gcm registration id from the set of backed up files. And query the API for a new registration ID whenever the app is restored.

Samir
  • 3,139
  • 2
  • 17
  • 24