The detailed documentation from Google can be found at http://developer.android.com/google/gcm/client.html
In the method below (as referenced in the URL above), send the GCM registration data to MACH using the sample below:
private void sendRegistrationIdToBackend() {
// Send your GCM registration data to the MACH URL,
//as described in the MACH API Guide. Sample code below:
ConnectionTask task = new ConnectionTask(this);
String[] params = new String[1];
params[0] = ConstantsAndUtilities.MACH_GENERIC_REG_URL+"?"+
"AppId="+ConstantsAndUtilities.MACH_GENERIC_APPID+"&"+
"SecretKey="+ConstantsAndUtilities.MACH_GENERIC_SECRET_KEY+"&"+
"DeviceUID="+ConstantsAndUtilities.getDeviceID()+"&"+
"PushToken="+ regid+"&"+
"DeviceType=2"+"&"+
"Custom1="+ getAccountPhoneNumber(); // get from database next time.
Log.w("Generic MACH","Posting..:"+params[0]);
task.execute(params);
}
To send a Push message to your Android device, you can use the Broadcast feature on the MACH Portal.
0 Comments