Code example for GoogleCloudMessaging

Methods: send

0
                    try { 
                        Bundle data = new Bundle();
                        data.putString("my_message", "Hello World");
                        data.putString("my_action", "eu.ttbox.geoping.ECHO_NOW");
                        String id = Integer.toString(msgId.incrementAndGet());
                        gcm.send(SENDER_ID + "@gcm.googleapis.com", id, data);
                        msg = "Sent message";
                    } catch (IOException ex) {
                        msg = "Error :" + ex.getMessage();
                    } 
                    return msg;
                } 
 
                @Override 
                protected void onPostExecute(String msg) {
                    mDisplay.append(msg + "\n");
                } 
            }.execute(null, null, null);
        } else if (view == findViewById(R.id.clear)) {
            mDisplay.setText("");