Open aneesv opened 9 years ago
Can you setup a breakpoint on the didReceiveRemoteNotification
method and see if it goes through there once you receive the notification?, that will tell us if you are not receiving it at all or the code is not actually working. Thanks.
I have tried its not going through didReceiveRemoteNotification
so i think notification is not receiving at all
+1 having same issue
A more detailed result 1# When app is running, we do get notification 2# When app is in background , we seldom get notification 3# when app is quit, we never get notification 4# when iphone is restarted: we never get any notification unless we open the app.
Testing on Iphone 5s ios 7.1.2 and ipad ios 8.0.
That's much more helpful, I will review during the weekend, I'm kind of busy lately. Thanks!
I think its GCM problem : check this https://github.com/googlesamples/google-services/issues/60
Well, I'm pretty sure I tried all the possible push notifications scenarios while developing the plugin, in any case I will definitely take a look this weekend.
had the same problem.
fix it by adding "priority": "high" to push message:
{
"registration_ids": ["nYG2y3HGY3...TSR-i3KWNqI"],
"notification": {
"title": "Hello, world!",
"body": "a",
"badge": 3,
"sound": "default"
},
"priority": "high"
}
That doesn't seem like a better option. I mean, what if we don't have control of the server? What if we don't have control of what we are to send (I am thinking in "production environment ")
I think @InViZz refers as priority as the GCM option: https://developers.google.com/cloud-messaging/http-server-ref
this doesn't work for me.
Android receives succesfully the notification...but nothing happens on iOs device. From my log i can see the registration token but when i use it with my test i cannot make it work
this is the php that i use for testing notifications
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'AIzaSyCsnHRL2XHSK13OOj5O0cXbVqePbu4WGVU' );
$registrationIds = array("muM0qrYW_D8:APA91bGqsN4Vs_218K-Nd8THUJgxVXymNyiRO-OqiaMNppWdC1SqPIismG0zbBjh8oiHO22_aJ6oVv8eNczNvsD6gPRg0bzGxKgXu7Y1AfSrNL0Z4uPZ2liVKFRLP935fUUXBtgvK-XL" );
// prep the bundle
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here'
);
// prep the bundle
$notification = array
(
"body" => "This week’s edition is now available.",
"title" => "NewsMagazine.com",
);
$fields = array
( 'to' => 'muM0qrYW_D8:APA91bGqsN4Vs_218K-Nd8THUJgxVXymNyiRO-OqiaMNppWdC1SqPIismG0zbBjh8oiHO22_aJ6oVv8eNczNvsD6gPRg0bzGxKgXu7Y1AfSrNL0Z4uPZ2liVKFRLP935fUUXBtgvK-XL',
'priority' => 'high',
'content_available' => true,
'notification' => $notification,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://gcm-http.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;
?>
the weird thing, is that this works ok with android. With iOs not only i'm not receiving any notification, but after some tests, it says that the token is invalid (but the token from the log it's still the same as before)
Any help would be really appreciated...i don't what to do
Notification is reciving when priority is set to "high"
also, its a hack around. iOS allows only certain numbers of push notifications to be sent to a device with priority high. Its affects the battery. So, you might don't want to use "priority: high".
anyone can tell me if there are any erorrs in my PHP?
@gonzaloaune Push notification is working fine (when using priority hight) while testing app on Xcode. But when uploaded to store and testing with testflight first gcm request is success (No notification) after that all request show error("error": "NotRegistered")
Any idea why this is happening ?
I think this scenario means that you have something wrong with certification. On Jan 8, 2016 12:54 PM, "Mohammed Anees v" notifications@github.com wrote:
@gonzaloaune https://github.com/gonzaloaune Push notification is working fine (when using priority hight) while testing app on Xcode. But when uploaded to store and testing with testflight first gcm request is success (No notification) after that all request show error("error": "NotRegistered")
Any idea why this is happening ?
— Reply to this email directly or view it on GitHub https://github.com/gonzaloaune/GCMPushPlugin/issues/4#issuecomment-170073772 .
I got this warning in the console while running the application. It seems relevant:
[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:],
but you still need to add "remote-notification" to the list of your supported UIBackgroundModes
in your Info.plist.
There's something very wrong with gcm in production environment it's kind of frustrating, setting up the development works like a charm, you get notifications in and out the app. but once I move to the production environment i get "unregistered" error with no explanations ... even if you set _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken, kGGLInstanceIDAPNSServerTypeSandboxOption:@NO}; :s :s
Set "priority": "high"
{
"to": "gcm_device_token",
"priority": "high",
"content_available": false,
"notification": {
"sound": "default",
"badge": "1",
"title": "Push Title",
"body": "Push Body"
}
}
Here's the code to use for production environment : appDelegate.m
_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};
Here's the code to use for development environment : appDelegate.m
_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
@soufianeEssabbane Do you still have the same problem, I'm experiencing the same thing. Everything works in the dev setup but after I want to try it in the production setup notregistered error message is returned and that's it.
This works for me.
$fields = array(
'registration_ids' => $registration_ids,
'data' => $message, <!-- where $message = array("message" => $message1, 'body' => $message1); -->
'content-available' => true,
'priority' => 'high',
'notification' => $message, <!-- where $message = array("message" => $message1, 'body' => $message1); -->
);
@soufianeEssabbane You have to set sandbox mode to false. Did you do that? It can be frustrating because if you build and forgot to do that it won't work. Every time you do a test build you have to set it to sandbox mode
@dtruel thanks for your feedback, I actually did solve it. But also moved to FCM where it handle the sandbox and prod mode by it self
yes, that fixed my problem, thank you)
2016-09-01 19:34 GMT+03:00 Soufiane notifications@github.com:
@dtruel https://github.com/dtruel thanks for your feedback, I actually did solve it. But also moved to FCM where it handle the sandbox and prod mode by it self
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gonzaloaune/GCMPushPlugin/issues/4#issuecomment-244136486, or mute the thread https://github.com/notifications/unsubscribe-auth/AJq2l5Zga3j7jXlclNSibdFSpyrB5Tgzks5qlv6bgaJpZM4Fyy5X .
While sending push notification GCM response with success
but notification is not receiving