0

I want to create a C# application to send a little message to my Android device.

I've found this article.

For first I've make a win form application and include the functions of the article, after I have registed an API KEY.

I've replaced the API KEY and ID project respectively:

Key for browser apps (with referers) with "YOUR_BROWSER_API_KEY" and "DEVICE_REGISTRATION_ID" with the code that I received from the link:

https://code.google.com/apis/console/#project:**code**:access

The project compiles correctly but when I send data it is returning me the following error:

    {"multicast_id":9036041256003980435,"success":0,"failure":1,
"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}

Can anyone help me?

Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
Antonio
  • 1,181
  • 4
  • 15
  • 34
  • so how you get DEVICE_REGISTRATION_ID excaly ? ... is should be string sended from device to your sever after registration of your app with GCM is complited on device ... – Selvin Sep 03 '12 at 13:31
  • Is your Android app working/do you get any errors? – kaderud Sep 03 '12 at 13:31
  • one moment... i'm newbie on GCM... for first i write an android application on my device? now i haven't android sdk on pc but, now, i want write only the windows application. – Antonio Sep 03 '12 at 13:37
  • so you have it ... but you can not check if it is working or not without device/emulator and android app ... you need to use `GCMRegistrar.getRegistrationId(context)` on your device to obtain valid DEVICE_REGISTRATION_ID and then you can use it with your PC app – Selvin Sep 03 '12 at 13:46
  • thanks Selvin, can i use the guideline of this [link](http://www.lalit3686.blogspot.in/2012/07/android-steps-to-run-gcm-demo.html) from point 9? what is the **SERVER_URL**? – Antonio Sep 03 '12 at 13:52
  • you need to build webservice for gathering DEVICE_REGISTRATION_ID from devices ... so as i've already wrote you can send DEVICE_REGISTRATION_ID to your webapp/webservice ... in SDK sample this webservice is written in java and it use Google app engine but you can build in C# as well ... – Selvin Sep 03 '12 at 13:56
  • And if i want send one message from c# to android device what do I need? obviously using the google server... – Antonio Sep 03 '12 at 14:02
  • Hi boys i have used this arcticle[link](http://stackoverflow.com/questions/11713363/i-can-not-get-registration-id-from-android-gcm) and my phone is correctly registed.... but when i use my c# application it's return me always the same error.. Please help ME – Antonio Sep 03 '12 at 16:17

1 Answers1

0

From your comments on your question it's not clear that you fully understand what Google Cloud Messaging is for: GCM doesn't send a message that automatically pops up a notification on your device (like a text message would), GCM sends a message to an application you run on your device, and then that application pops up a notification using the data that it received.

If you haven't written an Android app to run on your device yet, you won't be able to use GCM to send anything to it.

tophyr
  • 1,658
  • 14
  • 20