Code example for GoogleCloudMessaging

Methods: register

                try { 
                    if (gcm == null) {
                        gcm = GoogleCloudMessaging.getInstance(context);
                    regid = gcm.register(sender_id);
                    // 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. 
                    // Persist the regID - no need to register again. 
                    storeRegistrationId(context, regid);
                } catch (IOException ex) {
                return regid;
Connect your IDE to all the code out there  Get Codota for Java