i have one app in the play store, how can get play store application version name and version code using Cordova, any suggestion appreciated
To check updates, you need to take a platform-specific approach
iOS Approach
https://itunes.apple.com/lookup?bundleId=BUNDLE_ID
version
from response.data.results[0].version
and then compare it with the local version.https://itunes.apple.com/app/APP_ID
Android Approach
https://play.google.com/store/apps/details?id=BUNDLE_ID
https://play.google.com/store/apps/details?id=BUNDLE_ID
snippet
var parser = new DOMParser(),
doc = parser.parseFromString(response.data, 'text/html');
if (doc) {
var tag = doc.querySelectorAll(".hAyfc .htlgb");
if (tag && tag[6]) {
let storeVersion = tag[6].innerText.trim();
if (local_version != storeVersion) {
// send to stroe
}
}
}
Android approach is rather a DOM-based workaround as we are accessing the index directly using
tag[6].innerText.trim()
, but for iOS, it's a solid one.