0

I am working on an home automation system my android application can turn lights on and off using bluetooth, i want to add another feature of controlling the devices from webpage.

Can anyone tell me what is the easiest way to do this, i know GCM(Google Cloud Messaging) is the best solution but is there any other better or easy way of doing it.

And if anyone has some working piece of code, please share it with me; I want to finish this project as soon as possible

1 Answer 1

0

If you have a backend built using PHP, Rails etc you can have API's that the app can call and check for instructions. However, this has the side effect of draining he battery due to continous polling.

If you don't wanna go the "polling the server periodically" way, you can use GCM as you mentioned.

You can send data using the JSON data format. This is easily the lighest and most versatile data format used by many web and android apps and has tremendous support from third party libraries as well.

Here are some tutorials for this:

http://developer.android.com/guide/google/gcm/demo.html

http://android.amolgupta.in/2012/07/google-cloud-messaging-gcm-tutorial.html

http://www.londatiga.net/featured-articles/how-to-send-message-to-google-cloud-messaging-gcm-server-using-json-and-php/

http://fundroiding.wordpress.com/2012/06/29/google-cloud-messaging-for-android-gcm-simple-tutorial/

http://androidjayavelu.blogspot.in/2012/07/google-cloud-messaging-gcm-tutorial_27.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.