문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top