I want to be able to send push notification to a topic from device to device. I am already able to receive the notifications if I send them from a server but in the end I don't want a server to interact with my apps.
I wrote a method that send the notification that look like this :
-(void)sendNotif {
NSDictionary *message = @{
@"notification" : @"{ \"text\" : \"test\", \"title\" : \"test\"}",
@"to" : @"/topics/test"
};
// kSenderID is the senderID you want to send the message to
NSString *kSenderID = @"X";
NSString *to = [NSString stringWithFormat:@"%@@gcm.googleapis.com", kSenderID];
DLOG(@"dict %@, to : %@",message, to);
[[GCMService sharedInstance] sendMessage:message to:to withId:@"id1"];
}
But it seems nothing is sent.
So I have 2 questions : How do I write my method? How do I implement the callback methods?
A solution I found is to create my own HTTPRequest like in google example :