Search code examples
androidnotificationslockscreen

Notifications in Moto Display


I created a notification and it works but not display in Moto Display when locked. I changed Priority, Category etc with no effects. I want this notification like messages or missed cals: moto display

This runs as a service:

PendingIntent pendingIntent = PendingIntent.getActivity(this, requestCode /* Request code */, intent,
                PendingIntent.FLAG_ONE_SHOT);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.emblem2)
                    .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_help_red))
                    .setColor(getResources().getColor(R.color.colorFirst))
                    .setContentTitle(title)
                    .setContentText(location)
                    .setAutoCancel(true)
                    .setSound(defaultSoundUri)
                    .setShowWhen(true)
                    .setCategory(Notification.CATEGORY_ALARM)
                    .setLights(Color.YELLOW, 200, 200)
                    .setContentIntent(pendingIntent);

   notificationBuilder.setVibrate((sharedPreferences.getBoolean("notifications_new_message_vibrate", false) ? new long[]{0, 300, 200, 300} : new long[]{}));
            NotificationManager notificationManager =
                    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            notificationManager.notify(requestCode, notificationBuilder.build());

Solution

  • As pointed out by Marcin, Moto Display doesn't work with vector drawable in notification small icon. I had the same problem and changing the small icon resolved the issue.

    It's sad that such a nice feature as Moto Display doesn't have a documentation pointing that out.