1

I have an app that shows notifications I'm testing my app on many devices and it works well. But on OnePlus, the notifications of the app disappear and are not visible in the status bar. If the phone screen is on I am able to see the heads-up notification, but it won't stay in the status bar. If phone screen is off, I hear the device notification sound, but no notification on lock-screen or status-bar.

Here is the code I use:

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx)
        .setAutoCancel(true)
                .setSmallIcon(R.drawable.vimi_notification_icon)
                .setLargeIcon(icon)
        .setContentTitle(ctx.getString(R.string.app_name))
        .setLights(Color.argb(255, 0, 207, 255), 750, 2000)         
        .setContentText(content);

        mBuilder.setStyle(inboxStyle);


        if (!TextUtils.isEmpty(Common.getRingtone()) && playSound) {
            if(enoughTimeSinceLastSound) {
                mBuilder.setSound(Uri.parse(Common.getRingtone()));
            }
            playedSound = true;
        }


        int id_to_open = sd.id;
        if(sd.streamId != sd.id) {
            id_to_open = sd.streamId;
        }
        Intent intent = new Intent(ctx, VimiChatterMainActivity.class);
        intent.putExtra(Common.PROFILE_ID, String.valueOf(id_to_open));
        intent.putExtra(Common.CLEAR_NOTIFICATIONS, true);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pi = PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

        mBuilder.setContentIntent(pi);

        if(playedSound) {
            lastTimestampOfSoundPlay = System.currentTimeMillis();
        }

        if (Build.VERSION.SDK_INT >= 16) {
            mBuilder.setVibrate(new long[0]);
            mBuilder.setPriority(Notification.PRIORITY_HIGH);
        }
        mNotificationManager.notify(VIMI_NOTIFICATION_ID, mBuilder.build());

I've made sure that the app has permissions to show notification and that it is in the Doze white-list. I am out of ideas

amitfr
  • 1,033
  • 1
  • 9
  • 29

0 Answers0