Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Google Play using alert confirm button

Can you explain me how to launch the Google Play app using the alert confirm button?

Here's the code:

let confirm = this.alertCtrl.create({
  title: 'Nouvelle mise a jour disponible',
  message: 'Version ameliorer de eLahiya disponible, voulez vous la telecharger?',
  buttons: [
    {
      text: 'Plus tard',
      handler: () => {
        console.log('Disagree clicked');
      }
    },
    {
      text: 'Mise a jour',
      handler: () => {
        console.log('Agree clicked');
        window.open("play.google.com/store/apps/details?id=<package_name>", '_system', 'location=yes')//
      }
    }
  ]
});
confirm.present();

I want my app to open my app's page on the playstore, how to do it?

like image 439
Mahamadou Taibou Avatar asked Jun 29 '26 21:06

Mahamadou Taibou


2 Answers

this works perfectly for me:

window.open('market://details?id=your.package.name', '_system');

This is for Android though. For others:

IOS: itms-apps://itunes.apple.com/app/<appId>
Amazon: amzn://apps/android?p=<appPackageId>

Let me know if it works for you. Look into cordova-plugin-market as an alternative if that does not work.

like image 153
Sagar Kulkarni Avatar answered Jul 03 '26 17:07

Sagar Kulkarni


Ionic native has a plugin to open an app's page in the market place. Here it is cordova-plugin-market

Use this command to install this plugin,

 ionic plugin add cordova-plugin-market
 npm install --save @ionic-native/market

Usage,

import { Market } from '@ionic-native/market';

constructor(private market: Market) { }

...

this.market.open('your.package.name');
like image 30
Math10 Avatar answered Jul 03 '26 15:07

Math10



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!