问题描述
我正在使用离子2和phonegap推送插件()向设备发送通知
I'm using ionic 2 and phonegap push plugin (https://github.com/phonegap/phonegap-plugin-push) to send notification to device
当应用程序打开时没有问题,但是当我关闭应用程序时我没有收到我发送的任何通知。
When app is open there is no problem , but when i close the app I do not receive any notification i send.
是插件还是离子问题?
Is the problem with plugin or ionic ?
我使用的是最新版本的离子
I am using the latest version of ionic
和我的代码来注册推送通知:
and my code to register the push notification :
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
alert('Token saved:'+ t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
alert('I received push: ' + msg);
});
或者我必须为此添加一些代码?
or maybe i have to add some code for that?
推荐答案
由于您未收到有关MI手机的通知,您可以尝试更改优先级。我找到了一个他们说的页面,将它设置为优先级为'2'。
As you are not receiving notification on MI phone, you can try changing your priority. I found a page where they say, setting priority to '2' had it working.
这篇关于当应用关闭时,推送通知在离子2上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!