Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

How to go to Playstore and close the App?

$
0
0

Hello All,

I am trying to check the version of my application and if it mismatch than i want to make sure user to go to playstore and exitApp.

Promise.all([AppVersion.getVersionNumber()]).then(
                ([_appversion]) => {
                    appversion = _appversion;
                    mobile = _mobile;
                    this.updateAppDetails(
                        mobile,
                        android_version,
                        appversion,
                        appName,
                        vendor,
                        make
                    ).subscribe(
                        (_data) => {
                            let body: any = _data;
                            // let body = JSON.parse(data._body);
                            console.debug(body);
                            if (body.data != appversion) {
                                alert(
                                    "You are using old version of Application, Please update to the latest version"
                                );
                                Market.open("com.facebook.katana").then(data => {
                                    App.exitApp()
                                }).catch(error => {
                                    console.error("error")
                                }).finally(() => {
                                    App.exitApp()
                                })
                            }
                        },
                        (err) => {
                            console.error(err);
                        },
                        () => {
                            console.debug("update App Details successfull");
                        }
                    );
                }
            );

But with this code , the App Exits and Playstore don’t opens, Any idea of a Better solution?
I have seen couple of apps give update button in App itself, how to do that ?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>