Google cloud message(android) and window form(C#) - c#

I want to send message and specify phone number from destop window application(my app on destop) to android application(my app) on mobile device by google cloud message.
So I think I must create a new web service so that I can push message from that service to google cloud message.How can I can do that?

You will need the deviceID of your android device to send a notification to the device. So, you will need to design your web-service to have following functionality:
Receiving the deviceID from the android device.
Sending a message to the device whose deviceID is known to you. Your desktop app will need to talk to your web-service which can in-turn send message to google servers. GCM will handle sending notification.
The part of obtaining the deviceId of a android device to sending message is explained well here:
https://developer.android.com/google/gcm/index.html

Related

How to obtain GCM registration id using only C# code?

I want to send push notification to Android device using Amazon SNS service.
But as listed on Amazon's official site:
You send push notification messages to both mobile devices and desktops using one of the following supported push notification services:
Amazon Device Messaging (ADM)
Apple Push Notification Service (APNS) for both iOS and Mac OS X
Baidu Cloud Push (Baidu)
Google Cloud Messaging for Android (GCM)
Microsoft Push Notification Service for Windows Phone (MPNS)
Windows Push Notification Services (WNS).
So I am using GCM as an intermediary to send push notification to my Android device.
Here is an another link that states how to create project with GCM: http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html.
So far I have able to successfully create project in Google with my Server key and project number but only thing I am not getting is how to generate Registration Id and from where.
Do I need to programmatically generate registration id from my C# code?
But I couldn't find any code in C# to generate registration id. I have just find code in Android to generate Registration Id.
Having just set up SNS for a mobile app let me try and clarify a few things about SNS.
Amazon SNS is the intermediary not GCM. The workflow goes like this:
Using the GCM Project Key you set your app up for push notifications
A user downloads your app and when it launches, it connects to GCM
and lets Google know that this app/user combo would like to receive
push notifications.
GCM sends back a device token that represents this individuals device
and app instillation.
You send this device token to your c# server code where you can use
the SNS api to register the token with amazon and save it as a SNS
mobile endpoint.
Then you can use that endpoint Id and your server API key to send out
the notification.
This part of the documentation should be exactly what your looking for.
Hope this helps,
http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html

Send Message GCM from C#

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?
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.

What is the name of the service to be used for push notification?

I read about push notification in Windows Phone 7. I could use this mechanism to receive notifications from a web service: obviously, the web service must be designed to send notifications.
Can I use the push notification without knowing the name of the web service, but knowing its IP address and listening port?
What types of WCF bindings are supported by Windows Phone 7? I read that I can use only HTTP calls. So can Windows Phone 7 communicate only with BasicHttpBinding web services?
Regarding your first question about push notifications:
Your app will need to know about the web service you wish to receive messages from as you must pass it the channel Id to use to send messages to your app on that device. You don't need to know the "name" of it. You just need a Uri, which could, of course, just be an IP address and port number.

how to do point to point communication in windows phone 7 over gprs

can somebody help in finding out any way about how we can do point to point communication with windows phone 7 and a desktop computer over gprs.
Please it has becoma a showstopper for our project..
Thanks
Edit 1:
Yahya, The computer is having internet and also gsm modem with a network provider sim and the mobile is also having a sim. Where ever they are they have internet and we want to see each other or can send msg to each other over gsm, because when a gsm modem having proper data enabled sim from a mobile network operator is attached to a computer then the computer should able to talk to the mobile over gprs, because the mobile is also holding a valid gprs enabled sim.
Provided that both your endpoints Windows Phone 7 and Desktop have a SIM (or modem with a SIM) inside, you surely know the phone numbers of those SIMs.
if you want to communicate via GSM or via SMS you can send a SMS (Short Message) from one to the other and parse received messages on both and check if the message comes from the other side by checking the sender number than parse the data in the message as needed.
Differently if you go over GPRS or Data Transfer and you are on the Internet then the desktop could host a web service in IIS for example so the Phone can directly connect to such web service and call a method passing the data required to be transferred.
in fact you only need the phone to know the IP address of your server or desktop and to connect and consume the web service via the Internet when data connection is available and if not you can send a SMS to the desktop' SIM card.

Android and iPhone PNS details

i am crating a wcf data service for sending notification to iPhone and Android devices. i am writing server side code to register the devices, i just want to know what all information iPhone and Android send to server for registration process and what all things i need to store in my data base for sending notification to iPhone and Android.
Android and iOS PNS are really different, and will not send the same amount or structure of information to handle device registration, unregistration and message handling. You should start from the specific documentations from both those worlds and implement different services for each of them. These two worlds cannot be collapsed into one, I fear ...
WCF Data Service will not allow you to do push notifications to Android and iPhone. WCF Data Service (OData service = REST) offers only request response message exchange pattern where client (Android and iPhone) must ask for data by sending a request.

Categories