0

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());`
manj1790
  • 104
  • 7
  • Can you share your notification builder code? Looks like you are using an api (method) not present in KitKat. You could also try ```NotificationCompat``` from the support library. – iceman Sep 20 '17 at 07:08
  • `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);` – manj1790 Sep 20 '17 at 07:33
  • You should edit the question when you need to add more details. – iceman Sep 20 '17 at 07:58
  • In the notification code you have shared, there's no action set on the notification. Read this: https://developer.android.com/training/notify-user/build-notification.html#action. – iceman Sep 20 '17 at 07:59
  • I have already added, but its not working – manj1790 Sep 20 '17 at 08:44
  • I think you might be mixing ```android.support.v4.app.NotificationCompat``` & ```android.support.v7.app.NotificationCompat```. Can you check your imports and remove ```android.support.v7.app.NotificationCompat``` if present? – iceman Sep 20 '17 at 08:59
  • Its v4android.support.v4.app.NotificationCompat – manj1790 Sep 20 '17 at 11:20
  • I found a similar stacktrace in another question. Perhaps this might help you: https://stackoverflow.com/a/28951863/1773325 – iceman Sep 20 '17 at 14:13

0 Answers0