I have setup the Android part for C2DM, and here’s a part of the code:
private void handleRegistration(Context context, Intent intent) {
// (...)
else if (registration != null) {
Log.d("c2dm", registration);
Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
editor.putString(REGISTRATION_KEY, registration);
editor.commit();
// Send the registration ID to the 3rd party site that is sending
// the messages.
// This should be done in a separate thread.
// When done, remember that all registration is done.
}
}
So it says to send the registration ID to my server. What should I do with it, and how can I send messages in php?
Code examples would be great, as I’m not very experienced with PHP. I’ve seen this answer, but that uses sessions, which I’m not using.
You need to save it to a database like MySQL so you will be able to access it later when you want to push to the device.
Then you’ll send it somewhat like this
Get class.c2dm.php here:
https://bitbucket.org/Dianoga/php-c2dm/src/0c299de8f10b/class.c2dm.php