2017-04-06 48 views
0

您能否向我解釋如何使用提醒確認按鈕啓動Google Play應用程序?使用提醒確認按鈕打開Goog​​le Play

下面的代碼:

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(); 

我想我的應用程序打開的Play商店中我的應用程序的頁面,該怎麼辦呢?

回答

2

這個完美的作品對我來說:

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

這是Android雖然。對於其他人:

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

讓我知道它是否適合你。如果這不起作用,請考慮cordova-plugin-market作爲替代方案。

2

Ionic native有一個插件可以在市場上打開應用程序的頁面。這cordova-plugin-market

使用此命令來安裝這個插件,

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

用法,

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

constructor(private market: Market) { } 

... 

this.market.open('your.package.name'); 
相關問題