So this is the first time I am going to send an update for my app and I don\'t know about what actully happens when an app is updated via google-play,
Here are some ques
You need to implement a Broadcast Receiver that gets notified when the Paackage is beeing replaced:
In your Manifest include:
<receiver android:name="my.package.MyReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
The class MyReceiver
needs to extend android.content.BroadcastReceiver
To Answer your second question: The SharedPreferences aren't affected by an update through Google Play, as aren't the files in your App's data-Folder.
One way of checking if a new version has been installed is to use shared preferences. When the app is opened, you can check if an entry for that version is present. If it's not, a new version has been installed. After your processing is done, you can save the current version number in shared preferences.
As for your second question, shared preferences are not lost or reset by the update process. They stay as they were.
You can approach in this way
in the first time user install and start the application, you should store the current version as last_vertion_of_app in the shared preferences. then use a alarm Manager +broadcast receiver+service to check the manifest app version with shared preference stored version if both are different(not equal) that means some update happen. then you can do the thing what you want to happen if updated=true in the save service even without application starts.
You may be out of luck here as there is no clean way to do this with an already installed app. If you have in-app billing (and this is speculation) and Google's in-app billing system has a dynamic dashboard or API to register users, then, you can say setup a new unique key of some sort and track it through this in-app billing like system. This may not be possible though.
The second thing you can do is to look up users in your server database and create this file you mention for all users and hold them in server cache (for fast access). Then in your app on first launch of this new version you can quickly get this file to user. This seems to be a good safe solution.
Good Luck, this is an interesting problem and I will be looking forward to hearing how you will solve this.
Just remembered, you can also look into push notifications and pushing this data to users. But, this assumes your app has this.
@prateek User need to start the App manually from Android 3.1 to apply the Broadcast Receiver Solution. I do not think you have any option...Sorry Mate...A small advice is that, try to put a push notification handler when you really want to do something with user interaction or a broadcast receiver to trigger frequent operations without User Interaction...Cheers!