How to make your Android app auto update

dbDev picture dbDev · Jul 6, 2012 · Viewed 40k times · Source

I published my first app in Google Play today, woot! Once I saw my app listed in Google Play, I realized I needed to make a change and post an update.

I made my code changes and incremented versionCode and versionName in the manifest file. I then built my apk, signed with the same key as the original apk submitted to Google Play.

I uploaded a new apk, deactivated the original apk, then activated the new one and clicked Save.

I waited a couple of hours, looked in Google Play and could see that yes, the new value I put in versionName had updated.

On my Android Phone, I had originally installed the first version, but when I go to Google Play on that phone, I see the new version of my app, but the only options are "Open" and "Uninstall".

What do I need to do to my app in the Dev Console, or wherever, so the Update option appears when me or any other user goes to my app in Google Play?

Doing some research in Android Developer, I read this:

android:versionCode An internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName attribute. The value must be set as an integer, such as "100". You can define it however you want, as long as each successive version has a higher number. For example, it could be a build number. Or you could translate a version number in "x.y" format to an integer by encoding the "x" and "y" separately in the lower and upper 16 bits. Or you could simply increase the number by one each time a new version is released. http://developer.android.com/guide/topics/manifest/manifest-element.html

Then I found this:

Google Play can manage updates to preloaded applications, provided the following conditions are met: Package Name with the same Version Code of pre-loaded app must to be uploaded to the Developer Console http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=113476&topic=2365760&ctx=topic

So I'm confused, do I increment the Version Code or not. I'm pretty sure I should increment it, but then again the Update option is not showing up.

Answer

frogmanx picture frogmanx · Jul 6, 2012

Congratulations on your first app! It's a very exciting moment!

Yes, you increment your Version Code when you make an update to your app.

When you were testing your updated version, did you install the apk file onto your device? You might have updated it unknowingly. Google play will therefore detect that you have matching version codes with the app on your device and the app you uploaded and will not offer to update it.