2016-04-27 3 views
0

Я создал уведомление, и оно работает, но не отображается в Moto Display при блокировке. Я изменил приоритет, категорию и т. Д. Без эффектов. Я хочу, чтобы это уведомление как сообщения или пропущенные CALs: moto displayУведомления на дисплее Moto

Это работает как служба:

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()); 
+0

Возможно, ваши приложения заблокированы, хотя проверьте свою настройку ** звук и уведомление ** найдите **, когда устройство заблокировано **. –

+0

Я проверил, и я включил его, все приложения отображаются, кроме моего, даже подписанного приложения, возможно, оно должно быть отправлено из Google Play? – Marcin

+0

для подробной документации go [здесь] (http://developer.android.com/guide/topics/ui/notifiers/notifications.html) может быть, вы что-то пропустили. –

ответ

0

Как указал Marcin, Мото Дисплей не работает с вектором Drawable в небольшой значок уведомления. У меня была та же проблема, и изменение маленькой значки разрешило проблему.

Печально, что такая приятная функция, как Moto Display, не имеет документации, указывающей на это.

0
Notification notification = new Notification.Builder(context) 
    // Show controls on lock screen even when user hides sensitive content. 
    .setVisibility(Notification.VISIBILITY_PUBLIC) 
    .setSmallIcon(R.drawable.ic_stat_player) 
    // Add media control buttons that invoke intents in your media service 
    .addAction(R.drawable.ic_prev, "Previous", prevPendingIntent) // #0 
    .addAction(R.drawable.ic_pause, "Pause", pausePendingIntent) // #1 
    .addAction(R.drawable.ic_next, "Next", nextPendingIntent)  // #2 
    // Apply the media style template 
    .setStyle(new Notification.MediaStyle() 
    .setShowActionsInCompactView(1 /* #1: pause button */) 
    .setMediaSession(mMediaSession.getSessionToken()) 
    .setContentTitle("Wonderful music") 
    .setContentText("My Awesome Band") 
    .setLargeIcon(albumArtBitmap) 
    .build(); 

Это работало в моем Moto Z, возможно, работало только в режиме Media.

Смежные вопросы