package com.corneliudascalu.glass.phone;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * @author Corneliu Dascalu <corneliu.dascalu@osf-global.com>
 */
public class GcmReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
    }
}

@@ -35,16 +35,147 @@
 phone;%0A%0A
+import com.google.android.gms.gcm.GoogleCloudMessaging;%0A%0Aimport android.app.NotificationManager;%0Aimport android.app.PendingIntent;%0A
 import a
@@ -204,24 +204,24 @@
 stReceiver;%0A
-
 import andro
@@ -270,16 +270,66 @@
 .Intent;
+%0Aimport android.support.v4.app.NotificationCompat;
 %0A%0A/**%0A *
@@ -460,16 +460,16 @@
 verride%0A
-
     publ
@@ -520,16 +520,1676 @@
 tent) %7B%0A
+        GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);%0A        String messageType = gcm.getMessageType(intent);%0A        if (intent.getExtras().isEmpty()) %7B%0A            sendNotification(context, %22No message%22, %22Empty error%22);%0A%0A        %7D else if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equalsIgnoreCase(messageType)) %7B%0A            sendNotification(context, intent.getExtras().toString(), %22Error%22);%0A        %7D else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equalsIgnoreCase(messageType)) %7B%0A            sendNotification(context, intent.getExtras().toString(), %22Deleted%22);%0A        %7D else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equalsIgnoreCase(messageType)) %7B%0A            // TODO Parse message and start browser%0A            sendNotification(context, intent.getExtras().toString(), %22Received%22);%0A        %7D%0A    %7D%0A%0A    private void sendNotification(Context context, String msg, String title) %7B%0A        NotificationManager mNotificationManager = (NotificationManager)%0A                context.getSystemService(Context.NOTIFICATION_SERVICE);%0A%0A        PendingIntent contentIntent = PendingIntent.getActivity(context, 0,%0A                new Intent(context, MainActivity.class), 0);%0A%0A        NotificationCompat.Builder mBuilder =%0A                new NotificationCompat.Builder(context)%0A                        .setSmallIcon(R.drawable.ic_launcher)%0A                        .setContentTitle(title)%0A                        .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))%0A                        .setContentText(msg);%0A%0A        mBuilder.setContentIntent(contentIntent);%0A        mNotificationManager.notify(2, mBuilder.build());%0A
     %7D%0A%7D%0A

Test receive notification