Frage

I have a app on play store and i want to provide app update through the play store.

Also, on updation of the app i want to perform some task. So, how can i perform a task on updation of my app from the play store.

I thought of maintaining current version and cross check it every time the app is fired, is there any other efficient way such as any intent fired on app updation that can be handled on the device itself.

War es hilfreich?

Lösung

You can save your current version code in shared preferences and on upgrade, cross check the new version with the previously stored one.

if (savedVersionCode < currentVersionCode) {
    .
    .
    //PERFORM CERTAIN TASKS...
    .
    .
}

You can do this in your application's onCreate() or simply in you launcher activity's onCreate() if you have only one entry point.

Andere Tipps

The current version idea is a solid one. Just store it in the shared preferences and read it from there. It isn't really slow so the "negative" impact on performance can be simply ignored.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top