private void doGcmSendUpstreamMessage(String messageId) {

final GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
// final String senderId = "445270881816";
final String senderId = "502831140852";
final String msgId = messageId;
final String ttl = "";
final Bundle data = new Bundle();

data.putString("my_message", "Hello World");
data.putString("my_action", "SAY_HELLO");


if (msgId.equals("")) {
Toast.makeText(this, "no message", Toast.LENGTH_SHORT).show();
return;
}


new AsyncTask<Void, Void, String>() {
@Override
protected String doInBackground(Void... params) {
try {
if ( ttl != null && !ttl.equals("") ) {
try {
gcm.send(senderId + "@gcm.googleapis.com", msgId,
Long.parseLong(ttl), data);
} catch (NumberFormatException ex) {
Log.e(TAG, ex.getMessage());
return "Error sending upstream message: could not parse ttl";
}
} else {
gcm.send(senderId + "@gcm.googleapis.com", msgId, data);
}
Log.d(TAG, "Successfully sent upstream message");
return null;
} catch (IOException ex) {
Log.e(TAG, ex.getMessage());
return "Error sending upstream message:" + ex.getMessage();
}
}

@Override
protected void onPostExecute(String result) {
if (result != null) {
Log.d(TAG, "send message failed: ");
}
}
}.execute(null, null, null);
}