I would like to notify the us开发者_StackOverflow中文版ers when there is an update because the updates will be coming from my own website and not the market. However, do not want to have to update two places.
Either that or I would like to share the existing update notifier that is included with android. I am planning on uploading the app to one of our websites instead of the market.
Thanks!
AFAIK there is no public API for this provided by the Android OS or by the Android Market app. Note that hardware vendors often bundle their own update apps for this very reason.
Your best bet is to put the APK on your web server for download. Every time you download it, record the date from the Last-Modified HTTP header. Then in future you can poll this file using If-Modified-Since if your server supports this tag, if it doesn't you can get the header and check the Last-Modified date programmatically without downloading the HTTP contents.
Once you know an update is available, you can notify the user with your own notification code. If you plan to update the app programmatically, you will need to make sure you request the android.permission.INSTALL_PACKAGES permission in your manifest.
精彩评论