Code example for GoogleCloudMessaging

Methods: send

0
	                String msg = "";
	                try { 
	                    Bundle data = new Bundle();
	                    data.putString("hello", "World");
	                    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(Object msg) {
	                gcm_display.append(msg + "\n");
	            } 
	        }.execute(null, null, null);
	    } else if (view == findViewById(R.id.gcm_clear)) {
	        gcm_display.setText("");
Stop searching for code, let great code find you!  Add Codota to your java IDE