[android-developers] Re: Google Cloud Messaging (GCM) issues.
Hi, everyone, i used GCM days ago and it work well. but now i can't receiver any push messages, server send the message ok, and the log is: 07-12 14:20:50.735: D/ihsgcm(2239): send result error code name is null, whole result is [ messageId=0:1342074228753551%921c249af9fd7ecd ] but i can't receiver any push message with my client, and i tried use the google example(gcm client), it can't receive any one. dan all the clients didn't print any logs. please help me. On Wednesday, July 11, 2012 4:00:25 AM UTC+8, Senad wrote: Nevermind my last post.. I've figured out I used the wrong senderID.. One have to use the ID generated in the address bar.. e.g: https://code.google.com/apis/console/?pli=1#project:*64654065106* Thanks, Senad On Tuesday, July 3, 2012 12:11:25 PM UTC+2, Senad wrote: Hi, I've had C2DM implemented and working as well and now switched everything to work with GCM. The serverside seems to work well, meaning I'm getting the InvalidRegistration which is expected because I cannot register with my device. I've setup new API Project and registered my project with brand new Project ID which I've set to be the Sender ID in my app but I keep getting the INVALID_SENDER error. Any help appreciated.. (I've opened a new topic for my issue as well but as I'm new to this group it takes forever to get populated :( ) Thanks, Senad On Friday, June 29, 2012 4:22:02 AM UTC+2, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
I just made a mistake, I get a 401 Unauthorized with the html form.. Jeremy Le samedi 30 juin 2012 17:43:23 UTC+2, Elad Nava a écrit : This code will send a GCM message to multiple registration IDs via CURL. If you receive an *Unavailable* error code when you try to send a GCM: *Generate a Browser API Key from the Google APIs Console*, and use it *instead of the server key* in the Authorization header. Once you do that, this error will go away. This is caused by a serious mistake in the GCM Documentation that states you should use a Server Key in the Authorization header (as written herehttp://developer.android.com/guide/google/gcm/gs.html ) // Replace with real server API key from Google APIs $apiKey = 123456; // Replace with real client registration IDs $registrationIDs = array( 123, 456 ); // Message to be sent $message = x; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' = $registrationIDs, 'data' = array( message = $message ), ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
I use this code and the $result value looks like an empty string.. Do you have any idea why? I'm working with a local web page in php ( i use wamp). I already checked if curl is enable, and it should be working. I also tried with a basic html form and i get a 401 Unavailable, even with the browser api key. Jeremy NB: sorry for my english, I'm french Le samedi 30 juin 2012 17:43:23 UTC+2, Elad Nava a écrit : This code will send a GCM message to multiple registration IDs via CURL. If you receive an *Unavailable* error code when you try to send a GCM: *Generate a Browser API Key from the Google APIs Console*, and use it *instead of the server key* in the Authorization header. Once you do that, this error will go away. This is caused by a serious mistake in the GCM Documentation that states you should use a Server Key in the Authorization header (as written herehttp://developer.android.com/guide/google/gcm/gs.html ) // Replace with real server API key from Google APIs $apiKey = 123456; // Replace with real client registration IDs $registrationIDs = array( 123, 456 ); // Message to be sent $message = x; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' = $registrationIDs, 'data' = array( message = $message ), ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
Hi, I've had C2DM implemented and working as well and now switched everything to work with GCM. The serverside seems to work well, meaning I'm getting the InvalidRegistration which is expected because I cannot register with my device. I've setup new API Project and registered my project with brand new Project ID which I've set to be the Sender ID in my app but I keep getting the INVALID_SENDER error. Any help appreciated.. (I've opened a new topic for my issue as well but as I'm new to this group it takes forever to get populated :( ) Thanks, Senad On Friday, June 29, 2012 4:22:02 AM UTC+2, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
Nevermind my last post.. I've figured out I used the wrong senderID.. One have to use the ID generated in the address bar.. e.g: https://code.google.com/apis/console/?pli=1#project:*64654065106* Thanks, Senad On Tuesday, July 3, 2012 12:11:25 PM UTC+2, Senad wrote: Hi, I've had C2DM implemented and working as well and now switched everything to work with GCM. The serverside seems to work well, meaning I'm getting the InvalidRegistration which is expected because I cannot register with my device. I've setup new API Project and registered my project with brand new Project ID which I've set to be the Sender ID in my app but I keep getting the INVALID_SENDER error. Any help appreciated.. (I've opened a new topic for my issue as well but as I'm new to this group it takes forever to get populated :( ) Thanks, Senad On Friday, June 29, 2012 4:22:02 AM UTC+2, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
This code will send a GCM message to multiple registration IDs via CURL. If you receive an *Unavailable* error code when you try to send a GCM: *Generate a Browser API Key from the Google APIs Console*, and use it *instead of the server key* in the Authorization header. Once you do that, this error will go away. This is caused by a serious mistake in the GCM Documentation that states you should use a Server Key in the Authorization header (as written herehttp://developer.android.com/guide/google/gcm/gs.html ) // Replace with real server API key from Google APIs $apiKey = 123456; // Replace with real client registration IDs $registrationIDs = array( 123, 456 ); // Message to be sent $message = x; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' = $registrationIDs, 'data' = array( message = $message ), ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
I am using it from first IO day, so it work well. Il giorno venerdì 29 giugno 2012 11:54:51 UTC+2, Elad Nava ha scritto: No go for me or others either. It seems like the service is not available yet. It's only 2 days old. Let's give them some time to get it up and running. http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging/11254071#11254071 On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
No go for me or others either. It seems like the service is not available yet. It's only 2 days old. Let's give them some time to get it up and running. http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging/11254071#11254071 On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Google Cloud Messaging (GCM) issues.
I don't know about you, I switched from C2DM to GCM in couple of hours and all seems to work fine. You are welcome to take a look at my Drupal modulehttp://drupal.org/project/gcmthat do the actual sending, and the demo site http://demo6.mobile4social.com/ I built for all of it. If you need further help, I will be happy to try and give it to you. Regards, Shushu On Friday, June 29, 2012 5:22:02 AM UTC+3, RyanMC wrote: We are in the final stages of developing an app that had utilized C2DM for push notification, and decided to swap over to the new GCM since we hadn't released yet and it seemed like a good idea. However, this is proving to be a giant headache. We have the JSON and headers formatting correctly and we get back a valid response, but the failed count is always 1 and the error message is UNAVAILABLE. The documentation says to just try again, but this has proved pointless as it always returns the same result. I have seen several posts on stackoverflow and other sites that list a similar problem. Has anyone been able to get the new GCM stuff working? We are using a php backend to handle the push notifications. We are using the standard CURL library, and as far as I can tell the JSON is valid, and works as we do get a result. Prior to swapping out the old message attribute with the new data attribute it would fail to return any result, so I am pretty confident we have it right. Any thoughts would be appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en