SO I am wondering if its possible to implement some sort of notifications with Firebase and Ionic Framework, which I am using to create app. Can I stick with Firebase only, or do I need to get some other service, such as for example Parse?
Thanks!
EDIT:
I got Parse working - awesome. THe only thing that doesnt really work for me is the following code:
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;
}
It should send Push notificaiton to the targeted device, however it does nothing..
ANSWER:
Ok, the problem was with the following line:
registerNotification.deviceToken = deviceToken;
Changed to:
registerNotification.where= {deviceToken: deviceToken};
I'm unsure about Firebase but using Parse was easy to follow and understand, I managed to get everything working perfectly with the ngCordova Push Notifications.
https://parse.com/products/push
http://ngcordova.com/docs/plugins/pushNotifications/
https://www.parse.com/tutorials/ios-push-notifications
I hope these help.