开发者

Android programming. Vibration/LED light Function

开发者 https://www.devze.com 2023-03-03 02:53 出处:网络
Hi I have created a task reminder application.For example, you select a time of when to be reminded of a certain task, when that time comes, a notificatio开发者_如何学Pythonn comes up on the status ba

Hi I have created a task reminder application. For example, you select a time of when to be reminded of a certain task, when that time comes, a notificatio开发者_如何学Pythonn comes up on the status bar.

However I would like to implement a vibrating function and possibly an LED light function with the notification but I am not sure where to start? Does anyone know?

Thanks.


Have you looked at the Notification documentation? To set the led and have the phone vibrate, all you need to do is set the defaults field with the DEFAULT_LIGHTS and DEFAULT_VIBRATE values ORed together.

notification.defaults = Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE;


If you already have the code for creating and displaying the notification, the next lines of code will do:

notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_LIGHTS;

More details can be found here.


Just quick google search Creating Status Bar Notifications http://developer.android.com/guide/topics/ui/notifiers/notifications.html

0

精彩评论

暂无评论...
验证码 换一张
取 消