1

I have face strange issue on my app, sharedpreferences are cleared when I update the new version of apk.

I have used false for android:allowBackup. is this the reason ? if no, what I need on app side to keep my exiting preferences?

Thanks in advance

Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122
Rajasekaran M
  • 2,478
  • 2
  • 20
  • 30

2 Answers2

1

I don't have enought reputation to post a comment, sorry.

I think your issue is not related to that Manifest attribute, since what it does is to allow the device to include your app info for backups. Little info here.

Could you post how you access to your shared preferences? It's important to access the same preferences, so is it posible that your preferences id is composed with your application version or something similar? Just guessing, i'll try to be more helpful once you post the code :)

Joan
  • 321
  • 1
  • 10
1

Setting android:allowBackup to false should not cause any issue like what you are mentioning.

You don't need anything extra for keeping same shared preferences. Just make sure your code is not broken and you are referring to the same shared preferences, also the tag names.

It will be difficult to give more precise solution unless you post the actual code.

Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122