javaandroidwear-osandroid-wear-notification

Android Wear notification with auto focus like Gmap


I want to create an auto-focused notification.

I have noticed that notifications have two states in Android Wear :

FOCUSED, the time is invisible. When you start a navigation on Google Map, the default notification looks like this : focused notification


NOT FOCUSED, the time is visible :

not focused notification

You can switch from one state to another by gently dragging up or down the white notification square.

But on my app and unlike Gmap, the notification appears not focused.

My code on the wearable side (required for onGoing notifications) :

mBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentText("text")
                .setOngoing(true)
                .extend(new NotificationCompat.WearableExtender()
                                .setBackground(logoBitmap)
                                .setHintHideIcon(true)
                );
        (getSystemService(NOTIFICATION_SERVICE)
                .notify(NOTIFICATION_ID, mBuilder.build());

My notification appears unfocused like this : my-app

I tried setFullScreenIntent() but without any result.


Solution

  • I finally understood. Using setVibrate() extends the notification automatically. This is not mentioned anywhere in the doc, I just get lucky on this.