Code example for GoogleCloudMessaging

Methods: register

                String msg = "";
                try { 
                    if (gcmInstance == null) {
                        gcmInstance = GoogleCloudMessaging.getInstance(mActivity);
                    regid = gcmInstance.register(SENDER_ID);
                    msg = "Device registered, registration ID=" + regid;
                    // 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. 
                    // The request to your server should be authenticated if your app 
                    // is using accounts. 
                    // 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. 
                    // Persist the regID - no need to register again. 
                } catch (IOException ex) {