Open sillysachin opened 6 years ago
version = getJsoupString(updateURL.toString(), ".hAyfc", 7);
private static String getJsoupString(String url, String css, int position) throws Exception {
final Document document = Jsoup.connect(url).timeout(30000).userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6").get();
final Elements elements = document.select(css);
String version = "";
for (Element element : elements) {
if (element.childNodeSize() == 2) {
final String title = element.child(0).ownText();
final String value = element.child(1).child(0).child(0).ownText();
if ("Current Version".equalsIgnoreCase(title)) {
version = value;
}
}
}
return version;
}
Thank you @sillysachin. It could be a good workaround to avoid the position
but unfortunately, String title = element.child(0).ownText();
could be in other language rather than English. We should avoid hardcoded titles too.
Can you provide a callback way to handle this allowing developers to handle the scenarios? Currently i forked the entire repo, copy pasted into my folder structure and made it work.
https://play.google.com/store/apps/details?id=com.appbootup.ipo.news&hl=en and https://play.google.com/store/apps/details?id=com.appbootup.ipo.news&hl=hi
The hl parameter will ensure the title is always in english and i am slightly guessing is good enough solution.
Sorry to join the party too late. What position stands for? I made a full migration to Kotlin and I'm intended to use AppUpdater in a project of mine. I can provide this callback in version 3.0.
@marcosrocha85 hi, did u solved Jsoup problem?
@fukemy I ended giving up and I forgot why 😳
thanks, i just gave up too, trying to using https://developer.android.com/guide/playcore/in-app-update
The playstore listing has some time no entry for parameters like Size as in my case - https://play.google.com/store/apps/details?id=com.appbootup.ipo.news&hl=en
I checked that some apps have it and some do not - https://play.google.com/store/apps/details?id=com.olacabs.customer
In essence version = getJsoupString(updateURL.toString(), ".hAyfc .htlgb", 7); does not work in my apps case.
The solution it would seen to process all the fields with their titles nearby and then conclude which ones i version tag.