Notifications Firebase+Ionic框架:聊天通知
所以我想知道是否有可能用Firebase和Ionic框架实现某种通知,我正在用它来创建应用程序。我可以只使用Firebase,还是需要获得其他服务,例如Parse 谢谢 编辑: 我开始工作了-太棒了。唯一对我不起作用的是以下代码:Notifications Firebase+Ionic框架:聊天通知,notifications,firebase,ionic-framework,Notifications,Firebase,Ionic Framework,所以我想知道是否有可能用Firebase和Ionic框架实现某种通知,我正在用它来创建应用程序。我可以只使用Firebase,还是需要获得其他服务,例如Parse 谢谢 编辑: 我开始工作了-太棒了。唯一对我不起作用的是以下代码: function sendNotification(deviceToken, content){ console.log('targetDevice is: ' + deviceToken); console.log('content is:' + conte
function sendNotification(deviceToken, content){
console.log('targetDevice is: ' + deviceToken);
console.log('content is:' + content);
var notificationEndpoint = AY_Parse.parseEndpoint + "/1/push";
var headers = {
'Content-Type': 'application/json',
'X-Parse-Application-Id': AY_Parse.parseApplicationId,
'X-Parse-REST-API-Key': AY_Parse.parseRestApiKey
};
var pushNotification = $resource(notificationEndpoint, {},
{
'save': {
method: 'PUT',
headers: headers
}
});
var registerNotification = new pushNotification();
registerNotification.deviceToken = deviceToken;
registerNotification.data = {alert: content};
console.log(registerNotification);
console.log(angular.toJson(registerNotification));
return registerNotification.$save;
}
它应该向目标设备发送推送通知,但不执行任何操作
答复:
好的,问题出在下面这行:
registerNotification.deviceToken = deviceToken;
改为:
registerNotification.where= {deviceToken: deviceToken};
我对Firebase不太确定,但使用Parse很容易理解和理解,我成功地使用ngCordova推送通知使一切工作正常
我希望这些帮助 非常感谢你的回答!您能告诉我您是如何处理对等2对等通知发送的吗?或者您只是使用收件人令牌ID将数据发送到解析服务器,并在其中发送消息?我在Github上也发现了这一点,可能会有所帮助。太好了!非常感谢你!绝对没问题@UKShey Adam,所以我将设备令牌存储到我的Firebase帐户中,但是,我真的不知道如何将设备注册到Parse帐户。你能给我一些这方面的指导吗?