Clicking on Notification is not starting intended activity?

后端 未结 7 1710
野性不改
野性不改 2020-11-30 09:32

I am using GCM in my application and also using NotificationManager to Create a Notification whenever GCM message is received.Till now everything is working perfectly and GC

相关标签:
7条回答
  • 2020-11-30 10:30

    Here you just passed your Intent into pendingintent: see below

    Intent notificationIntent = new Intent(context, Login.class);
    
     PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    and set this contentintent into your Notification:
    
    Notification noti = new NotificationCompat.Builder(context)
                        .setSmallIcon(icon_small)
                        .setTicker(message)
                        .setLargeIcon(largeIcon)
                        .setWhen(System.currentTimeMillis())
                        .setContentTitle(title)
                        .setContentText(message)
                        .setContentIntent(**contentIntent**)
                        .setAutoCancel(true).build();
    

    This may help you.

    0 讨论(0)
提交回复
热议问题