I have following logs, while tapping on notification. When I tap on notification it didn't bring app to foreground or open app. This is happening in KitKat only, on other its work fine. Also, for note that I have used GCM for notification and firebase for auth.
09-20 12:14:43.390 3076-3076/com.testapp E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
09-20 12:14:43.390 3076-3076/com.testapp E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
09-20 12:14:43.410 3076-3263/com.testapp E/MyGcmListenerService: Bundle[{google.sent_time=1505889885380, gcm_order=3, title=Test 1, google.message_id=0:1505889885603858%e6c595e0f9fd7e12, message=Test 1}]
09-20 12:14:43.430 3076-3263/com.testapp D/dalvikvm: DexOpt: couldn't find field Landroid/app/Notification;.headsUpContentView
09-20 12:14:43.430 3076-3263/com.testapp W/dalvikvm: VFY: unable to resolve instance field 20
09-20 12:14:43.430 3076-3263/com.testapp D/dalvikvm: VFY: replacing opcode 0x5b at 0x005d
09-20 12:14:43.430 3076-3263/com.testapp D/dalvikvm: DexOpt: couldn't find field Landroid/app/Notification;.headsUpContentView
09-20 12:14:43.440 3076-3263/com.testapp W/dalvikvm: VFY: unable to resolve instance field 20
09-20 12:14:43.440 3076-3263/com.testapp D/dalvikvm: VFY: replacing opcode 0x5b at 0x004c
09-20 12:14:43.450 3076-3263/com.testapp D/dalvikvm: DexOpt: couldn't find field Landroid/app/Notification;.headsUpContentView
09-20 12:14:43.450 3076-3263/com.testapp I/dalvikvm: DexOpt: unable to optimize instance field ref 0x0014 at 0x54 in Landroid/support/v7/app/NotificationCompat;.addHeadsUpToBuilderLollipop
09-20 12:14:43.450 3076-3263/com.testapp D/dalvikvm: DexOpt: couldn't find field Landroid/app/Notification;.headsUpContentView
09-20 12:14:43.450 3076-3263/com.testapp I/dalvikvm: DexOpt: unable to optimize instance field ref 0x0014 at 0x61 in Landroid/support/v7/app/NotificationCompat;.addHeadsUpToBuilderLollipop
09-20 12:14:43.460 3076-3263/com.testapp D/NotificationManager: com.testapp: notify(1000, Notification(pri=0 contentView=com.testapp/0x10900cf vibrate=default sound=default defaults=0x3 flags=0x10 kind=[null]))
Here's my code:
android.support.v4.app.NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(getNotificationIcon())
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setContentTitle(title)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setAutoCancel(true);
Intent notificationIntent = new Intent(this, activityName);
notificationIntent.putExtras(data);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(contentIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(BROADCAST_NOTIFICATION_ID++, mBuilder.build());`