我makin这个科尔多瓦/离子项目在我使用后端解析。 我希望用户能够向其他用户发送消息。当这样做时,推送通知应该出现在接收者的设备上。解析离子应用程序自动推送通知的可能性
这应该跨越Android和iOS。
只有使用离子和解析才可能做到这一点吗?
我makin这个科尔多瓦/离子项目在我使用后端解析。 我希望用户能够向其他用户发送消息。当这样做时,推送通知应该出现在接收者的设备上。解析离子应用程序自动推送通知的可能性
这应该跨越Android和iOS。
只有使用离子和解析才可能做到这一点吗?
我正在研究类似的项目。
以下是获得基本构思的一些步骤
a。注册到Parse.com
b。对于使用Ionic构建项目,您需要一个JS插件来访问Parse组件。使用这个GitHub Plugin
c。复制粘贴app.js
// You'll get the appId and Clinet Key from Parse.com
parsePlugin.initialize(appId, clientKey, function() {
parsePlugin.subscribe('SampleChannel', function() {
parsePlugin.getInstallationId(function(id) {
/**
* Now you can construct an object and save it to your own services, or Parse, and corrilate users to parse installations
*
var install_data = {
installation_id: id,
channels: ['SampleChannel']
}
*
*/
}, function(e) {
alert('error');
});
}, function(e) {
alert('error');
});
}, function(e) {
alert('error');
});
d在ionicPlatformReady()
下面的代码。从Parse帐户仪表板发送推送通知进行测试,您应该可以看到它。
注意
这是很可能,你可能会得到错误说Reference to parsePlugin not defined.
这意味着科尔多瓦插件是没有得到加载时执行。
我希望它有帮助。祝一切顺利。
谢谢,
¿收到通知时你怎么做?当您按下通知或将其引入您的应用程序以触发某些事件时,无法触发事件。 – clopez
默认情况下,解析通知将简单地打开应用程序..如果您想要自定义行为,您可以实现自定义广播接收器,然后处理它 – Incpetor
[FrostyElk/cordova-parse-plugin](https://github.com/FrostyElk/cordova-parse-plugin)提供了将推送通知数据发送到JavaScript层的功能。查看'ParsePlugin.js'中定义的'getPendingPush()'。 (对于Cordova 5支持,请在[mobiRic/cordova-parse-pushhandler](https://github.com/mobiRic/cordova-parse-pushhandler)查看我的项目分支) –
您是否设法在IOS上对此进行分类?建议插件的下面的回答只有android。 –
你有没有得到iOS与Parse + Cordova一起工作? –