我创建了一个移动应用程序(Ionic + Cordova)。安装了,,但是当我收到推送通知或离开屏幕时,我会丢失所有本地通知。如果用isScheduled函数来检查它们,我就得到了真。如果删除推送通知代码
var config = null;
if (ionic.Platform.isAndroid()) {
config = {
"senderID": "111111111111" // REPLACE THIS WITH YOURS FROM GCM CONSOLE - also in
我实现了推送通知。除了总是显示"1“的徽章之外,它工作得很好。
我的代码如下所示:
var push = new Ionic.Push({
"debug": true
});
push.register(function(token) {
console.log("Device token:",token.token);
//Here I make an http post to my server to store device token
push.saveToken(token); // persist the token in the Ionic
这听起来可能很愚蠢,但是在我读了很多关于这个话题的文章之后,我仍然对推有点困惑。
对我来说,有两种推动:
1 - When your phone is idle and suddenly an "alert" pops up in the phone telling you something has happened with your app
2 - When you are "inside" the app and you get notified about something (maybe a new user joined the chat in a
如何在Android混合应用中使用built on Ionic Framework发送推送通知。我是新手,请逐步指导我如何用ionic发送推送通知?我在youtube和其他网站上看到了不同的教程,但我不知道在哪里添加这些网站上显示的代码。我有GCM项目编号(SENDER_ID),但不知道把它放在哪里。请详细指导。提前谢谢。