mardi 26 mai 2015

Android gcm notification doesn't open application

I'm using the below code as my receiver and I want to open the application with let's say the specific activity but it doesn't work and nothing happens on notification click:

PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0) 

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
Notification n = builder.setContentIntent(pIntent)
    .setSmallIcon(R.drawable.ic_launcher)
    .setTicker(title)
    .setWhen(System.currentTimeMillis())
    .setAutoCancel(true)
    .setContentTitle(title)
    .setContentText(msg)
    .build();
n.defaults |= Notification.DEFAULT_VIBRATE;
n.defaults |= Notification.DEFAULT_SOUND;
mNotificationManager.notify(0, n);

and this is my intent initialized earlier:

Intent intent = new Intent(this, Activity_Notification.class);

Aucun commentaire:

Enregistrer un commentaire