Superunknown
Superunknown

Reputation: 171

Android programming. Vibration/LED light Function

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 notification 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.

Upvotes: 1

Views: 3254

Answers (3)

Gabriel Negut
Gabriel Negut

Reputation: 13960

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.

Upvotes: 1

peter_budo
peter_budo

Reputation: 1748

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

Upvotes: 0

Wesley Wiser
Wesley Wiser

Reputation: 9871

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;

Upvotes: 3

Related Questions