Download content when the app is updated via Google Play?

So, this is the first time I’m sending an update for my application, and I don’t know what happens when the application is updated via google-play,

Here are some questions that I could not answer:

  • What is really being updated and how does this process work, that is, methods or callbacks when updating?

  • What happens to the shared-preferences file, does the pair of / reset name values ​​change ?

Let's say I want to download a file from the server, when the application is updated using google play , and perform some operations with this file in the background. How can I approach this correctly.

- Edit -

To make it more understandable, I want to automatically do some processing when the application is updated by the user, and he does not want to open the application, and for this I am looking for a trigger that is provided by Google play my application using any intent [implicit or explicit].

+6
android auto-update
Nov 15 '13 at 6:44
source share
5 answers

You need to implement a broadcast receiver that receives Paackage replacement notification:
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 MyReceiver class should extend android.content.BroadcastReceiver

To answer your second question: SharedPreferences is not affected by the update via Google Play, as well as files in the application data folder.

+5
Nov 18 '13 at 7:50
source share

One way to check if a new version is installed is to use general settings. When the application is open, you can check if an entry is present for this version. If it is not, a new version has been installed. After processing is complete, you can save the current version number in the general settings.

As for your second question, the general settings are not lost or reset during the update process. They remain as they were.

+1
Nov 15 '13 at 11:59
source share

You may be out of luck as there is no clean way to do this with an already installed application. If you have billing in the application (and this is speculation), and the Google billing system for applications has a dynamic dashboard or API for registering users, then you can say that you need to install a new unique key and track it through this billing application, as system. This may not be possible.

The second thing you can do is to find users in your server database and create this file, which you specify for all users, and keep them in the server cache (for quick access). Then, in your application, when you first start this new version, you can quickly get this file to the user. This seems to be a good safe solution.

Good luck, this is an interesting problem, and I will look forward to how you resolve it.

Just remember, you can also view push notifications and push this data to users. But this assumes your application has this.

0
Nov 20 '13 at 18:10
source share

@prateek The user needs to start the application manually with Android 3.1 in order to use the Broadcast Receiver Solution. I don’t think you have any option ... Sorry, Mate ... A little tip: try putting a push notification handler when you really want to do something with user interaction or the broadcast receiver to start frequent operations without user interaction ... Hooray!

0
Nov 21 '13 at 12:12
source share

You can come this way

the first time the user installs and starts the application, you should save the current version as last_vertion_of_app in the general settings. then use the signaling manager + broadcast receiver + service to check the version of the manifest application with the saved version of the general preference, if they are different (not equal), which means that some update will happen. then you can do what you want if update = true in the save service even without starting the application.

0
Nov 22 '13 at 3:10
source share



All Articles