PHCA C2DM Settings

 

C2DM (for Cloud to Device Messaging) is Android’s push messaging service. It use no extra battery power. There is no polling that takes place. Think of this service as being very similar to text messaging. When a message comes in, it is pushed to your phone and you are notified. There is no background service that is running, taking up CPU time. The phca code does nothing until a message comes in. Then once a message does come in, the code is very small, basically just updating the variable value in a database and then updating any widgets or menus that are displaying that variable. It is very fast (near real time) and relatively easy to configure. For instance, you might want to get immediate notifications of your burglar alarm sounding, guest account being used, lights left on, doors opening/closing, etc. It is all up to and your PowerHome installation.

Before you can use C2DM you must register at https://phc-a.net (free). After you register, come back to your phone and select the “Configure C2DM push messaging” button from the main configuration menu. Enter in the same username and password that you used at the phc-a.net site. Soapbox alert! Hopefully you used a different username and password when registering than you use for any other important sites. If someone hacks into my site and gets your username and password, and they figure out it is the same username/password that you use for paypal, I would feel awful if they did something bad. But I wouldn’t feel *that* bad because I did warn you

After you enter in the username and password, click Register for C2DM messaging. You should see a little popup (called a “toast” in Android) that says registration was successful. If not, doublecheck your username and password. If you were successful, then we can test the push messaging using a regular web browser. First create a variable called “cloudpushtest” and some variable value settings for values such as “test” or “rapunzel”. After you have done that, enter the following url in the address bar of any web browser, but don’t hit ENTER yet because you will need to edit your username and password with the username/password from the phc-a.net site.

https://phc-a.net/send.php?username=MYUSERNAME&password=MYPASSWORD&

varname=cloudpushtest&varvalue=rapunzel&verbose=true

(url split onto two lines for display purposes)

After you have corrected the username and password, hit enter. After a few seconds you should see a toast stating that the variable has been updated. You should see something similar to this on the web page:

If you are having problems, try unregistering C2DM and re-registering. If that doesn’t work, try the app “Chrome to phone” from the google market. If it doesn’t work for you, then your phone may not be C2DM capable. All phones with FROYO and newer should work. If you are still having problems, post a message here and I will try to help.

 Posted by at 1:06 am

Leave a Reply