1

Here is my problem scenario.

I am working on an application which will essentially search the play store for a set of applications to get their version numbers and check with the versions of installed apps and notify the user if there is an update available.

So I need to know,

  1. Is there a way to get the version number of an app from play store? Do google expose any APIs for this purpose? I did something like below from command line using CURL, but got an error.

    $ curl https://play.google.com/store/apps/details?id=my.app.id.here
    curl: (35) Unknown SSL protocol error in connection to play.google.com:443
    
  2. How can I get the version of an installed app in Android?

    This part is solved using getPackageManager().getInstalledPackages()

tshepang
  • 12,111
  • 21
  • 91
  • 136
gnuanu
  • 2,252
  • 3
  • 29
  • 42

1 Answers1

1

I do not experience the certificate error with curl. Perhaps ensure your packages including certificate store are up-to-date?

As a general habit I suggest surrounding the URL in quotes as some common url characters can be interpreted by the shell. The following snippet retrieves the app version from the play url:

$ curl -s 'https://play.google.com/store/apps/details?id=org.thoughtcrime.redphone' | xmllint --xpath "//div[@itemprop='softwareVersion']/text()" --html - 2> /dev/null 
 0.9.6

I notice that google applications have application versions that vary by device:

$ curl -s 'https://play.google.com/store/apps/details?id=com.google.android.apps.maps' | xmllint --xpath "//div[@itemprop='softwareVersion']/text()" --html - 2> /dev/null 
   Varies with device  
user650881
  • 2,214
  • 19
  • 31
  • Is it possible to somehow specify the device/platform in the url? E.g. If I know I have a phone, it should be possible to set "...&device=phone" or similar. – l33t Aug 24 '15 at 08:50
  • @l33t Yes, you can add parameters to the URL like you suggested. The single quotes should keep you from having to escape the & in order to prevent it from being interpreted by the shell. You can also change the referer with the `-e` option in curl. – user650881 Aug 25 '15 at 18:26
  • Ok. But which parameter controls the device info? Does the Google Play web even care about the device? – l33t Aug 25 '15 at 18:38
  • I have not looked at google play closely in quite a long time. My somewhat cloudy recollection is that apps that target a specific platform or geo location are filtered if you do not meet the criteria. I suspect the referer is more likely used than a url param, but some research or testing would be necessary. – user650881 Aug 25 '15 at 19:03