Code example for GoogleCloudMessaging

Methods: register

		try { 
			if (mGCM == null) {
				mGCM = GoogleCloudMessaging.getInstance(mContext);
			mRegId = mGCM.register(GCM_SENDER_ID);
			msg = "Device Registered, registration id = " + mRegId;
			// You should send the registration ID to your server over HTTP, 
			// so it can use GCM/HTTP or CCS to send messages to your app. 
			// For this demo: we don't need to send it because the device 
			// will send upstream messages to a server that echo back the 
			// message 
			// using the 'from' address in the message. 
			// Save the regid - no need to register again. 
			setRegistrationId(mContext, mRegId);
		} catch (IOException e) {
			msg = "Error while registering : " + e;
Connect your IDE to all the code out there  Get Codota for Java