在Ionic 2中获得Play商店应用版本

时间:2017-11-02 10:20:07

标签: android ajax ionic-framework ionic2 google-play-services

我想查看我在Playstore上传的应用版本以进行强制更新。我该怎么办 ?我试图点击http请求,但得到cors问题,它会给html的结果。  我试过跟随api电话

this.http.get( "https://play.google.com/store/apps/details?id=com.moglix.vendor").subscribe(data => { alert(data); });

我检查了其他解决方案,例如How get the app version on the play store它对我不起作用。

我有rest api的替代方案,但我想只从Play商店查看任何功能。

2 个答案:

答案 0 :(得分:0)

请看一下这个插件:Ionic Native App Update Plugin

使用此插件,您可以检查是否有适用于您的应用程序的更新。注意:这需要后端存储应用版本信息,并且应与APK同时更新。

答案 1 :(得分:0)

使用JQuery,您可以在具有angularjs项目的ionic1中使用它:

$.get("https://play.google.com/store/apps/details?id=--bundleID--", function(data){
            htmlContentsArray=$('<div/>').html(data).contents();
            htmlContents=htmlContentsArray['prevObject']['0']['childNodes']['141'].outerText;
            if(htmlContents == ''){
                htmlContents=htmlContentsArray['prevObject']['0']['childNodes']['144'].outerText;
            }
            latest_version_array=htmlContents.split('Current Version');
                var latest_version_string=latest_version_array['1'];
                var latest_version=latest_version_string.substr(0,5);
});
相关问题