问题描述:

I'm not sure if this is in the wrong StackExchange, so if it is, please let me know.

I'm making an Android app that I'd like to use GCM for. Unfortunately, I don't have a server available for me to run this off of. The best I have is a GoDaddy hosted webserver. So, since I figured running GCM off of my webserver wouldn't work, I need to find some other way. Thus, my question: Is it possible to use a local computer with GCM instead of a server? This way, I can use my laptop instead of a server.

Also, if you know of someway to make the GoDaddy hosting work with GCM that would be even better. The GoDaddy is a shared webhosting account, not a VPS or a dedicated sever.

Thanks!

网友答案:

Yes, you can send a GCM message from your local computer to your Android device via GCM server. All you need is to be connected to the internet, and send an HTTP request to the GCM HTTP endpoint.

However, in order to send such a message, you need to know the Registration ID of the device that should get the message. The application of the device gets this ID when it registers to GCM. Usually, once the app receives this ID, it passes it to your server. If you use your local computer as a server, you will find it difficult to send the registration ID from your app to it (though you might be able to do it if you are running a local web-server on your local computer, and the Android device and your computer are connected to the internet by the same network).

Of course, you can always copy the registration ID manually and paste it into your code that sends the GCM messages.

网友答案:

Yes it is possible, as a matter of fact im using this gcm sender application to test my gcm-client in phone. I wrote an abstraction of gcm-client for simpleton like me here

hope it helps :).

相关阅读:
Top