javiersantos / AppUpdater

A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 9+ required.
Apache License 2.0
1.98k stars 412 forks source link

Always get Latest Version 0.0.0.0 update from GOOGLE_PLAY #132

Closed SetiaBudy-Mail closed 6 years ago

SetiaBudy-Mail commented 6 years ago
Details
Builder
AppUpdaterUtils appUpdaterUtils = new AppUpdaterUtils(this)
                .setUpdateFrom(UpdateFrom.GOOGLE_PLAY)
                .withListener(new AppUpdaterUtils.UpdateListener() {
                    @Override
                    public void onSuccess(Update update, Boolean isUpdateAvailable) {
                        Log.d("Latest Version ",  update.getLatestVersion());
                        Log.d("Release notes",  update.getReleaseNotes());
                        Log.d("URL",  update.getUrlToDownload().toString());
                        Log.d("Is update available? ", Boolean.toString(isUpdateAvailable));
                    }

                    @Override
                    public void onFailed(AppUpdaterError error) {
                        Log.d("AppUpdater Error", "Something went wrong");
                    }
                });
        appUpdaterUtils.start();
Problem

Hi.. I want to ask, why I always get return Latest Version 0.0.0.0 while in the playstore has its version 1.0.0 thanks.

Expected Result

Latest Version 1.0.0 Release notes URL https://play.google.com/store/apps/details?id=com.vcard.sg&hl=en Is update available?true

Actual Result

Latest Version 0.0.0.0 Release notes URL https://play.google.com/store/apps/details?id=com.vcard.sg&hl=en Is update available?false

ivalice93 commented 6 years ago

i'm getting the same issue of unable to check app version, it always returns 0.0.0.0 and false on isUpdateAvailable

ps-jimmy commented 6 years ago

I am also having same issue here, it always returns 0.0.0.0 and false on isUpdateAvailable

javiersantos commented 6 years ago

Thank you for letting me know. I'm looking into it.

bayrontq commented 6 years ago

The Google Play code has stopped reflect the field softwareVersion

buneme commented 6 years ago

Same here

buneme commented 6 years ago

@javiersantos maybe the structure of the html page has changed?

tdtran commented 6 years ago

Google indeed updated the Google Play website. What we do in this library is HTML scraping. Since Google does not provide a stable API for this purpose, that's the only option we have. Unfortunately HTML scraping is fatally sensitive to any changes in Play Store website. To make it worse it's entirely possible that Google does staged rollout, some user's (countries of origin, last digit of their IP address, whatever) may get a different version of the web than others. I personally decided to step back from using this library to notify users about new versions of my apps.

apurv-verma-007-kranti commented 6 years ago

I am also having same issue here

kushanshah11 commented 6 years ago

@javiersantos same Issue Occurred. Update Dialog not pop Up.

supersume commented 6 years ago

@javiersantos This issue can be solved by reading the tag with the htlgb class in the Play Store HTML

<span class="htlgb"><div><span class="htlgb">2.1</span></div></span>

tdtran commented 6 years ago

@supersume the css class htlgb is used in much more places in that html. We'd need to include Current Version in the pattern and that is localized so we need to fetch the en version of the html to parse for the version name, then localized version for what's new. What if the app is for a local market, ie not available for en speaking countries, no english app listing either? I also guess that class name is generated by whatever css tool google engineering is using. That means it can change at any time without adv notice.

pmrajani commented 6 years ago

here is log i can show in my IDE.

E/AppUpdater: Cannot retrieve latest version. Is it configured properly?


Code setup : i have added it on MainActivity onCreate method.

AppUpdater appUpdater = new AppUpdater(this); appUpdater.start();

kushanshah11 commented 6 years ago

@javiersantos have you solved this problem?

tejasgawali4 commented 6 years ago

@javiersantos getting the same error.

E/AppUpdater: Cannot retrieve latest version. Is it configured properly?

luciovinicius commented 6 years ago

anyone? i'm getting the same error

chaitanya-teja commented 6 years ago

I think it has not been updated yet after google changed their html source.

vishnu-simplecrm commented 6 years ago

Still facing the same issue. Is it resolved? if (yes){ "Do I need to update dependency"} else{ "Till when it will be resolved?"}

kushanshah11 commented 6 years ago

HI @javiersantos I can get Latest Version Using Jsoup.

is this parameter used by you in this lib?

newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=com.otto.excellence&hl=it")
                        .timeout(30000)
                        .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                        .referrer("http://www.google.com")
                        .get()
                        **.select(".hAyfc .htlgb")**
                        .get(7)
                        .ownText();
                return newVersion;

Let me know your thought on same.

Thanks

serrokitskiy commented 6 years ago

waiting

vishnu-simplecrm commented 6 years ago

At least give us the timeline, till when the issue will be resolved. Or should we look for other libraries.

kushanshah11 commented 6 years ago

Hi All, if you want alternate way to get play store App Version

compile 'org.jsoup:jsoup:1.8.3'


 private class GetVersionCode extends AsyncTask<Void, String, String> {
        @Override
        protected String doInBackground(Void... voids) {

            String newVersion = null;
            try {
                newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=com.otto.excellence&hl=it")
                        .timeout(30000)
                        .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                        .referrer("http://www.google.com")
                        .get()
                        .select(".hAyfc .htlgb")
                        .get(7)
                        .ownText();
                return newVersion;
            } catch (Exception e) {
                Log.e("Exception", e.getMessage());
                return newVersion;
            }
        }

        @Override
        protected void onPostExecute(String onlineVersion) {
            super.onPostExecute(onlineVersion);

            Log.d("update", "playstore version " + onlineVersion);
        }
    }
serrokitskiy commented 6 years ago

@kushanshah11 D/update: playstore version 5.0 and up

kushanshah11 commented 6 years ago

@serrokitskiy i dont understand...

serrokitskiy commented 6 years ago

@kushanshah11 Log.d("update", "playstore version " + onlineVersion); return D/update: playstore version 5.0 and up

not version of application

kushanshah11 commented 6 years ago

@serrokitskiy i have checked with same code and i get correct result. here i attached snap so you have better idea.

or you can send me link of playstore app for which you are testing so i can investigate for same.

image

Thanks in advance.

serrokitskiy commented 6 years ago

@kushanshah11 https://play.google.com/store/apps/details?id=dev.rokitskiy.wfab

kushanshah11 commented 6 years ago

@serrokitskiy just update

.get(5)

and you will get your version code.

serrokitskiy commented 6 years ago

@kushanshah11 ok, thk

kushanshah11 commented 6 years ago

@serrokitskiy let me know once done

ebenites commented 6 years ago

I changed my code using JSON mode. https://github.com/javiersantos/AppUpdater/wiki/UpdateFrom.JSON It's work for me

almaz010891 commented 6 years ago

Same problem

deltaguita commented 6 years ago

I create a feature request to google, hope developer can get official support https://issuetracker.google.com/issues/111101725

javiersantos commented 6 years ago

Hi guys. I want to clarify that there is no definitive solution to the problem, since Google Play does not provide an API to obtain the latest version.

I will work on a temporary solution that will solve the problem. Please, I advise you to use an alternative and more reliable method (such as JSON or XML).

javiersantos commented 6 years ago

Update 2.7 is now available with the workaround based on Jsoup. Please note that this is a temporary solution and the Google Play website may change at any time.

https://github.com/javiersantos/AppUpdater/releases/tag/2.7

MrAnkit007 commented 4 years ago

I couldnt understand how to use it properly. should I use it in activity.xml or activity.java

PS: Sorry I am new to this