firebase - ionic 3上的集成推送firebase通知
问题描述
我正在尝试使用firebase推送,我的代码是正确的,我放置了一个console.log来查看它是否有权限,如果一切都正确,但是当我通过firebase发送通知时。我什么都没有。。
app.component.ts
.then((res: any) => {
if (res.isEnabled) {
console.log('We have permission to send push notifications');
} else {
console.log('We do not have permission to send push notifications');
}
});
const options: PushOptions = {
android: {},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error))
配置文件
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
<plugin name="phonegap-plugin-push" spec="^2.1.3">
<variable name="SENDER_ID" value="1064226096335" />
</plugin>
xcode 中的控制台
01:30:14.735620-0300 Myapp[4390:567615] FCM Sender ID 1064226096335
2018-06-08 01:30:14.735644-0300 Myapp[4390:567615] Using FCM Notification
2018-06-08 01:30:14.897536-0300 Myapp[4390:567453] FCM token is null
2018-06-08 01:30:14.898198-0300 Myapp[4390:567453] We have permission to send push notifications
2018-06-08 01:30:14.902557-0300 Myapp[4390:567453] Push Plugin register success: <c1e83f2d 3a9c1fd2 0115d192 4f3d27ce 53c217d3 4b861176 ff65cbac c4ceae9d>
火力基地
解决方案
推荐阅读
- c# - 使用身份服务器 4 撤销令牌
- java - 找不到百分比 - JAVA
- linq - Linq to Entities - 相关子查询
- reactjs - 知道如何动态地将 manifest.json 添加到 html 头
- amazon-web-services - 是否可以使用 AWS 代理为 http 后端启用 https?
- bash - 如何在带有密码提示的bash脚本中检查路由器的SSH登录状态
- android - Androidx底部导航栏在可隐藏的导航项上保持突出显示
- ruby-on-rails-5 - 活动管理员编辑器未成功上传表单
- amazon-web-services - CloudWatch Insights 过滤到仅包含查询字符串的主页请求
- pdf - iTextSharp v5 - 如何在内存中连接 PDF?