samedi 13 août 2016

iOS custom push notification from rails server using Firebase ( FCM )

im using Firebase now for push notifications. I have successfull get push notifications from Firebase Console after follow instructions from Firebase Documentation, but the problem is how to send push notifications from my backend server? (im using Rails and i have installed the FCM).

After i trigger push notifications from my backend server,i got this message in Xcode Console:

Message ID: (null)

when i print using NSLog(@"%@", userInfo); i got this.

{
"collapse_key" = "do_not_collapse";
content = "{\"user\":{\"name\":\"Calvin Sugianto"\},\"type\":\"MessageNotification\"}";   
from = 220735382338;
type = Notification;
}

i want my iphone get push notification like "Calvin Sugianto has messages you"

how to handle it from my Xcode Objective C ? Should i change it`s format like the Firebase Console Format?

{
aps =     {
    alert = "Calvin Sugianto has messages you";
    badge = 1;
    sound = default;
};
"gcm.message_id" = "0:1471091040938034%2dd6ae602dd6ae60";
"gcm.n.e" = 1;
"gcm.notification.sound2" = default;
"google.c.a.c_id" = 2581112629335483434;
"google.c.a.c_l" = LabelMessage;
"google.c.a.e" = 1;
"google.c.a.ts" = 1471091040;
"google.c.a.udt" = 0;
type = MessageNotification;
}

i read from other tutorial, i must implement FCM HTTP API. but how?

Aucun commentaire:

Enregistrer un commentaire