Firebase + Ionic Framework:聊天通知

Firebase + Ionic Framework: Chat notifications

所以我想知道是否可以使用我用来创建应用程序的 Firebase 和 Ionic Framework 实现某种通知。我可以只坚持使用 Firebase,还是需要一些其他服务,例如 Parse?

谢谢!

编辑:

我让 Parse 工作了 - 太棒了。唯一对我不起作用的是以下代码:

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 推送通知完美配合。

https://parse.com/products/push
http://ngcordova.com/docs/plugins/pushNotifications/
https://www.parse.com/tutorials/ios-push-notifications

希望这些对您有所帮助。