我想从一个应用程序向另一个应用程序发送和提醒。我正在开发这两个应用程序,他们正在交谈,但我在这个警告问题中感到困惑。下面是我的代码:
<ion-item style="align-items: center;">
<button color="green" ion-button (click)="presentAlert()">
<ion-icon name="alert"></ion-icon> {{'o que quer alertar?' | translate}}
</button>
</ion-item>
presentAlert() {
let alert = this.alertCtrl.create({
title: '!!* Atenção *!!',
subTitle: 'Uma mensagem de alerta!',
buttons: ['Já vou ver...']
});
alert.present();
}它在同一个应用程序上正常工作。如何将此警报发送到其他应用程序?
编辑: pick-up.html (发送者)
<ion-item (click)="getDirection(trip.destination.location.lat,trip.destination.location.lng)">
<h2 class="font-lbr">{{'Destino' | translate}}</h2>
<p class="font-lbr-p">{{ trip.destination.vicinity }}</p>
<button color="green" item-right dark ion-button (click)="getDirection(trip.destination.location.lat,trip.destination.location.lng)">
<ion-icon name="navigate"></ion-icon> {{'Navegar' | translate}}
</button>
</ion-item>
<allow-intent href="receiver://*/*" />
</ion-list>现在,“接收者”tracking.ts..。
playAudio(){
if(PLAY_AUDIO_ON_REQUEST == true){
let audio = new Audio(AUDIO_PATH);
audio.play();
}
}
this.deeplinks.route({
'/alert': 'Alert',
'/navigate': 'Navigate',
}).subscribe(match => {
if (match.$route === 'Alert') {
let alertData = {
title: match.$args['title'],
subtitle: match.$args['subtitle'],
button1text: match.$args['button1text']
button2text: match.$args['button2text']
}
presentAlert(alertData);
}
}, nomatch => {
//handle no match
});
}这是正确的方式吗?
EDIT2:我这里没有deeplinks插件...
发布于 2019-05-24 14:08:47
您可以使用deeplinks插件。假设你有发送者和接收者应用程序。接收器应用程序需要有一个像这样的receiver://alert?title=title&subtitle=subtitle&button1text=buttontext&button2text=button2text唯一的网址方案。
按照行文使用代码
this.deeplinks.route({
'/alert': 'Alert',
'/navigate': 'Navigate',
}).subscribe(match => {
if (match.$route === 'Alert') {
let alertData = {
title: match.$args['title'],
subtitle: match.$args['subtitle'],
button1text: match.$args['button1text']
button2text: match.$args['button2text']
}
presentAlert(alertData);
}
}, nomatch => {
//handle no match
});您可能需要在发件人应用程序中使用allow-intent
<allow-intent href="receiver://*/*" />https://stackoverflow.com/questions/56282670
复制相似问题