1

this is my question:

I need my app to verify if a new version is available on the market. Potentially it would show an alert dialog notifying that an update is available and then take the user to the market.

I know that the market does that if the user checks that option, but many people don't bother taking a look at updates, and I really need to give them a nudge to get the update.

I didn't find any suitable solution for this, as I've read before that an app can´t retrieve this information from the market. Is searching for a value in an html file on my server a possibility?

John Conde
  • 217,595
  • 99
  • 455
  • 496
6r0pius
  • 65
  • 8
  • 3
    Yes, "searching any value in an html inside my server" works. Put a textfile, php page or whatever you like on a webserver, on app start (maybe limited to once per day) read current version from there, compare and show update hint if version on web > your version. – zapl Aug 24 '12 at 16:01
  • thanks.... and how am I supposed to do that? lol... I have no idea, I'm very new in this. – 6r0pius Aug 24 '12 at 16:15
  • This topic is duplicated. http://stackoverflow.com/questions/29575046/force-app-to-update-when-new-version-of-app-is-available-in-android-play-store/40006390#40006390 – Vansuita Jr. Oct 13 '16 at 10:53

1 Answers1

1

What you want is prvided by a really GREAT library you can use called aQuery: Here is the page that goes over it's check for upgrade functionality http://code.google.com/p/android-query/wiki/Service

And it does SOOOOO much more too.

petey
  • 16,914
  • 6
  • 65
  • 97
  • thanks !!! this seems that it will do what I'm looking for. A question, besides adding those lines, do I have to import something into the app? – 6r0pius Aug 24 '12 at 16:26
  • Yea. you need to download the library jar file (see Downloads) and place it in your libs folder. From there, start coding. They also have sample apps you can download too which is like looking thru any of the apidemos stuff. – petey Aug 24 '12 at 16:29
  • ok, I've imported the jar file, and added: MarketService ms = new MarketService(this); ms.level(MarketService.MINOR).checkVersion(); but it closes the app... any idea? – 6r0pius Aug 24 '12 at 16:43
  • 08-24 13:53:58.852: E/dalvikvm(2040): Could not find class 'com.androidquery.service.MarketService', referenced from method com.altaguia.muros.MainActivity.onCreate 08-24 13:53:58.852: W/dalvikvm(2040): VFY: unable to resolve new-instance 456 (Lcom/androidquery/service/MarketService;) in Lcom/altaguia/muros/MainActivity; – 6r0pius Aug 24 '12 at 16:55
  • hmm.. right click project > Java build Path > Order & Export > find the check box next to Android Dependencies and check it on. Then Project > Clean. Then rebuild and test again. – petey Aug 24 '12 at 17:27
  • well... finally I figured it out what was causing the problem. I was inserting those lines before setContentView(R.layout.activity_main); and it's supposed to be inserted after it. Now... I had to use the force version of the code to show the dialog to see if it's working, because if I use the automatic code (if there is not a new version nothing happens) it doesn't alert me for new version. How can I use the automatic version and mek it appear? Sorry for my english... thanks !! – 6r0pius Aug 24 '12 at 18:06
  • @PalashAgrawal you might be possible to use something like [jsoup](http://jsoup.org) to scrape out the information from the play website listing. But as the play website changes you will need to update your app to pull this correctly. You could always create your own webservice to contain this info too. – petey Oct 09 '14 at 13:42
  • @petey thanx! actually i need version code of my app to be fetched from google play. and when i use jsoup i only get version name of my app. can you tell me how can i fetch version code. – Palash Agrawal Oct 10 '14 at 05:14
  • View the source html of the your play listing, then check the documentation on the jsoup site to learn how to scrape that content out for your url. – petey Oct 10 '14 at 05:17