Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vibrate an Android Wear device on notification

I'm trying to develop an app for android and Android Wear (Wear OS). I create a Notification from the mobile to the watch.

notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(icon)
                    .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000, 1000})
                    .setContentTitle(title)
                    .setContentText(content)
                    .setStyle(bigStyle.bigText(content))
                    .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), background))
                    .build();

In the manifest of the watch I set:

<uses-permission android:name="android.permission.VIBRATE"/>

Unfortunately, there is no vibration. How can I fix it?

Thanks.

like image 278
Samy Sup Avatar asked Oct 14 '14 14:10

Samy Sup


1 Answers

 .setDefaults(Notification.DEFAULT_ALL)

This line of code will make the wear wake up and vibrate.

like image 200
android enthusiast Avatar answered Sep 30 '22 02:09

android enthusiast