checkNotNull(SENDER_ID, "SENDER_ID"); GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this); TextView mDisplay = (TextView) findViewById(R.id.display); String regId = ""; if (!GCMRegistrar.isRegistered(this)) { mDisplay.setText("registering"); GCMRegistrar.register(this, SENDER_ID); regId = GCMRegistrar.getRegistrationId(this); String url = "localhost/Google-Cloud-Messaging-Server-Test/registration.php?regId=" + regId; Log.i(TAG, "registration url: " + url); HttpRequest httprequest = new HttpRequest(url); } else { regId = GCMRegistrar.getRegistrationId(this); mDisplay.setText(regId); Log.v(TAG, "Already registered"); GCMRegistrar.unregister(this); } regId = GCMRegistrar.getRegistrationId(this); String url = "localhost/Google-Cloud-Messaging-Server-Test/registration.php?regId=" + regId;