Android Question Getting App Version from PlayStore

mmieher

Active Member
Licensed User
Longtime User
This code below worked for years, but something has changed.

I have already tried AppStore and AppStorePlus libraries. Project will not compile.
"Okio" already added if OkHttp library is in list. I need OkHttp.

I also tried the carreto.pt thing. Does not work.

Tried CheckAppVersion and that does not work either.

Any ideas?
Marc

B4X:
'-- Activity Create
SendVersionRequest("com.pmc.pmctech10")

Sub SendVersionRequest(packagename As String)
    Dim jb As HttpJob
   
    jb.Initialize("version", Me)
    jb.Download2("https://play.google.com/store/apps/details", Array As String("id", packagename))
   
    mLog("DB","Sent Version Request")
End Sub

Sub VersionComplete(inText As String)
   
    Log(inText)
   
    Dim m As Matcher
    Dim UriStr As String = "market://details?id=com.pmc.pmctech10"
    Dim Intent1 As Intent
   
    '    m = Regex.Matcher("softwareVersion\" & QUOTE & ">([^<]+)</dd>", inText)
    m = Regex.Matcher("softwareVersion\" & QUOTE & ">([^<]+)</div>", inText)    '    Google Changed something
   
    If m.Find Then
       
        mLog("DB","version = " & m.Group(1)) 'VERSION FOUND
       
        If s.Val(PgmVer) < s.Val(m.Group(1)) Then
       
            Msgbox("Please select UPDATE when the PlayStore opens ...","")
       
            Intent1.Initialize(Intent1.ACTION_VIEW,UriStr)
           
            Try
                StartActivity(Intent1)
            Catch
                Dim PI As PhoneIntents
                StartActivity(PI.OpenBrowser("https://play.google.com/store/apps/details?id=com.pmc.pmctech10"))
            End Try
           
            SendVersionRequest("com.pmc.pmctech10")
           
        End If
    Else
       
        mLog("ERR","version Not found")
       
    End If
   
End Sub

Sub JobDone(Job As HttpJob)
    mLog("DB","JobDone: JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        If Job.JobName = "version" Then
            VersionComplete(Job.GetString)
        End If
    Else
        mLog("ERR","JobDone: Error = " & Job.ErrorMessage)
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub

This is what google returns:
<!doctype html><html lang="en" dir="ltr"><head><base href="https://play.google.com/"><meta name="referrer" content="origin"><link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Google Play"><link rel="shortcut icon" href="//www.gstatic.com/android/market_images/web/favicon_v2.ico"><script data-id="_gd" nonce="8e/+V/gNAHTjvzZSX83jT7fx/lA">window.WIZ_global_data = {"DpimGf":false,"EP1ykd":["/_/*"],"FdrFJe":"4817803715551879717","Im6cmf":"_/PlayStoreUi","JxkZB":{},"LVIXXb":1,"LoQv7e":false,"QrtxK":"","S06Grb":"","Yllh3e":"%.@.1523466521558000,174249043,2198837564]\n","c7nB8c":false,"cfb2h":"boq_playuiserver_20180403.09_p0","eNnkwf":"1523466521","eptZe":"/_/","fPDxwd":[],"fuqsbf":{},"gGcLoe":false,"nQyAE":{"KHpdpf":"false","tBSlob":"false","AUkF5c":"UA-19995903-1","Mrhm1c":"https://play.google.com","MhR8Kc":"65","fpvLbe":"","TlFcIe":"https://play.google.com/store/ereview"},"qEndFb":"PlayStoreUi","qymVe":"NOVHXDf4hH4V4teii03zMxwJqGo","rtQCxc":420,"w2btAe":"%.@.null,null,\"\",false]\n","zChJod":"%.@.]\n","zQmIje":"US"};</script><script nonce="8e/+V/gNAHTjvzZSX83jT7fx/lA">(function(){'use strict';var b=window,f=b.performance,h=g(),n,p;n=f&&(p=f.timing)&&p.navigationStart?0:h;function g(){return f&&f.now?f.now():(new Date).getTime()}
b.l=function(t){function k(a){var c={};c[a]=g();q.push(c)}function u(a,c){if(!c||"none"==c.style.display)return!1;var d=a.defaultView;if(d&&d.getComputedStyle&&(d=d.getComputedStyle(c),"hidden"==d.visibility||"0px"==d.height||"0px"==d.width))return!1;if(!c.getBoundingClientRect)return!0;var e=c.getBoundingClientRect();c=e.left+b.pageXOffset;d=e.top+b.pageYOffset;if(0>d+e.height||0>c+e.width||0>=e.height||0>=e.width)return!1;a=a.documentElement;return d<=(b.innerHeight||a.clientHeight)&&c<=(b.innerWidth||
a.clientWidth)}function r(a,c){l[a]=Math.max(l[a]||0,g());m[a]=m[a]||u(b.document,c)}b.cc_aid=t;b.iml_start=n;var q=[{"":n},{n2h:h}];b.cc_latency=q;b.ccTick=k;b.onJsLoad=function(){k("jsl")};b.onCssLoad=function(){k("cssl")};var l={};b.iml_ticks=l;var m={};b.iml_is_visible=m;b._recordIml=r;document.documentElement.addEventListener("load",function(a){a=a.target;if("IMG"==a.tagName&&!a.hasAttribute("data-iid")&&!a.hasAttribute("data-src")){var c=a.src;c&&r(c,a)}},!0)};}).call(this);
l('MNgTFf_PL')</script><script nonce="8e/+V/gNAHTjvzZSX83jT7fx/lA">var _F_cssRowKey = 'boq-play.PlayStoreUi.-13g06x9hsiy56.L.X.O';var _F_combinedSignature = 'AB1caFXSqsDxJr2P3-piIfRllqeoV_Pj7g';function _DumpException(e) {if (goog.global['$googDebugFname'] && e && e.message && !e.fileName) {e.message += ' in ' + goog.global['$googDebugFname'];}throw e;}document.createElement('content');</script><style data-href="https://www.gstatic.com/_/boq-play/...GcB/d=1/rs=AB1caFXXEbDD_d-_zYHIwYmHmiy8Mf7PtA" nonce="8e/+V/gNAHTjvzZSX83jT7fx/lA">html{height:100%;overflow:hidden}body{height:100%;overflow:hidden;color:rgba(0,0,0,0.87);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;margin:0;text-size-adjust:100%}textarea{font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif}button{outline:none}a{text-decoration:none;color:#2962ff}img{border:none}#apps-debug-tracers{display:none}html{overflow:visible}body{overflow:visible;overflow-y:scroll}.VfPpfd{display:inline-block;margin-left:5px}.SUZt4c{display:inline-block;text-decoration:line-through}.dN4Mje{font-weight:bold}.oQ6oV{display:table;margin-bottom:40px;width:100%}.hkhL9e,.D0ZKYe,.MxwSyf{display:table-cell;vertical-align:top}.D0ZKYe{height:1px;padding-right:30px;width:465px}.rlnrKc,.i9550b{display:table;height:100%;width:100%}.sIskre{display:table-row}.wE7q7b{display:table-row;vertical-align:bottom}.KO5dHd,.hfWwZc{display:table-cell;vertical-align:bottom}.KO5dHd{padding-right:20px}.hfWwZc{text-align:right}.yb6DRb .oQ6oV{display:block;margin:15px 10px 20px 15px;width:auto}.RJN5Sc{margin-top:15px}.vJLnod{margin-top:5px}.lYfMqd,.E74osb{width:100%}.yb6DRb .rYTkof{text-align:left}.k8Lt0 .rYTkof{text-align:right}.EmVfjc{display:inline-
Message longer than Log limit (4000). Message was truncated.
 

DonManfred

Expert
Licensed User
Longtime User
This is what google returns
In the past it was a html output with html-code... Google changed it some months ago.
The page is now much more javascript instead of static html
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
I dont know. Find a new way (if there is one) or an Api which you could use (dont know if there is any)

Relying on a specific html-layout (build by someone other) was a mistake in the past and is as of now.

Thanks DonManfred. @#$*% Google. You would think this would be something provided by Google PS.
 
Upvote 0
Top