tags:

views:

78

answers:

1

Hi,

Could someone explain in technical details how an android application handles updates ? . What kind of information does the application usually needs to send to request an update , and what does it receives back ? .

+2  A: 

Updates to applications themselves are handled centrally by the Market application. You upload your updated apk to the Market via the website, and your users will be prompted to upgrade over the next couple of days.

This is why it is very important to retain your .keystore file with which you sign your apps. If you don't have this signature, you cannot update your apps for security reasons.

Your application doesn't need to contain any update logic of its own.

Jim Blackler
klaud-vlad: this is also why the rest of your questions cannot be answered -- the Android Market is not open source, so we do not know all of what it does.
CommonsWare
Well, suppose I want to provide updates via my web site ?
rantravee
You can do that. A user can install a link from a standard http web link to an apk file. On the first occasion their device will prompt them to enable the 'Non-Market Applications' options in the preferences, but this is quite straightforward. You could easily call a web service from your app to find out if a newer version is available and to direct users to download it via the Android Browser. One advantage of this approach is some control over upgrade rate rather than the 'big bang' approach which is all that is supported by the Market.
Jim Blackler
Super, that's pretty much what I want to do. When the user hits the "check for updates" button, a checking for new updates through a server request is performed, and if there are , and the user agrees to update , the updating process should begin. For this ,is it sufficient to have back from the server , the link for downloading the apk ?
rantravee
..are there any other information mandatory the server should send back ?
rantravee
No it can be super-simple. I'd send an http request to my service (perhaps an App Engine service), something like `http://example.com/update.jsp?versionCode=3` where the versionCode comes from the manifest version. Then I would have the service either return blank (no update) or a URL to which the user should be directed to get the new apk.
Jim Blackler
Hey Jim, how is an app able to retrieve its version code?
Adam
So the user receives the url (available updates), and uses the Android browser to download the apk on the mmc from the provided link. Can you describe what should happen further with the new downloaded apk ? , should it be used by the apps installer ?
rantravee
More specifically I mean how the new apk and the installed application are combined ?
rantravee
You trigger a new intent to visit the URL. The user then gets sent to the browser which downloads the apk.
Jim Blackler
@Adam `getPackageManager().getPackageInfo(getPackageName(), 0).versionCode`
Jim Blackler
Thanks for the info provided !
rantravee