0

I was wondering which approach is best for forcing users to update my android application.

Should I just ask my server if there is a new version in the main activity and if there is just prompt a message and call System.exit(0); or is there is a nicer approach to this? Is it possible to check the playstore for new update? Or is this behavior of forcing update a bad practice? even if the update is important (that would make some features not work in old versions)?

Thanks

klifa
  • 671
  • 1
  • 8
  • 27

1 Answers1

3

Generally, it is best to respect the user's choices. In Android, users can choose whether or not to enable automatic updates (and whether or not to update at all).

That being said, you wouldn't be the first developer to implement this functionality. If you do go this route, I would recommend calling finish() on your Activities instead of calling System.exit(0); to ensure that everything goes through the Activity lifecycle properly.

There is some great discussion about quitting an application in general at Quitting an application - is that frowned upon?.

Another alternative to forcing users to update your application when your application relies on a remote server (such as a PHP backend) is to provide backwards compatibility when you update the backend. You don't necessarily need to provide backwards compatibility indefinitely, but providing at least a few versions of support is probably a good idea.

Community
  • 1
  • 1
Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • Thank you. I was already reading that discussion after i posted this so i realized that System.exit should not be used for this purpose. I did take into consideration backwards compatibility in the backend but there are some things that are just too expensive and not worth it doing it. Do you know if there is any way to check the newest version against the playstore? – klifa Jan 24 '14 at 16:18
  • Unfortunately no, the Play Store does not have any public APIs at this time. When I have seen this implemented elsewhere, it is usually a config file (e.g. a JSON file) stored on the developer's server that the app checks against at launch. – Bryan Herbst Jan 24 '14 at 16:21