Al Hennessey
Al Hennessey

Reputation: 2445

Google Cloud Messaging and MySQL database

I want to use Google Cloud Messaging for my app for both upstream and downstream use, using xmpp. However I am wondering how I can select and input data to and from my MySQL database to be sent over the GCM network.

Can I use PHP with GCM or do I have to use Java or Python?

Upvotes: 1

Views: 504

Answers (2)

user2965003
user2965003

Reputation: 334

There are XMPP libraries for PHP. See https://code.google.com/p/xmpphp/ for example. So, PHP is possible, however i would really like to hear what is a recommended approach, as im going to implement it too.

Upvotes: 0

varun113
varun113

Reputation: 451

GCM is used for sending messages FROM server TO your android application. Also a GCM message can only carry a maximum of 4KB Only. So in my opinion, send data to your MySQL db directly from the app (If you want to make this asynchronous, look into Android Sync Adapter); and for sending data from server to your application asynchronously, send a ping to your app using GCM (it can be any short message), so your app can undergo a normal http request-response procedure to get the data from MySQL.

For more information of Sync Adapters: http://developer.android.com/training/sync-adapters/index.html

And for a tutorial on a simple GCM using PHP: http://www.programming-techniques.com/2014/01/google-cloud-messaging-gcm-in-android.html

Upvotes: 2

Related Questions