Hardware Notifications
You can flash LEDs on the device by setting lights to true, also specifying the color (as an value in ) and what pattern the light should blink in (by providing off/on durations in milliseconds for the light via and ).
You can play a sound, using a to a piece of content held, perhaps, by a . Think of this as a ringtone for your application.
You can vibrate the device, controlled via a indicating the on/off patterns (in milliseconds) for the vibration (). You might do this by default, or you might make it an option the user can choose when circumstances require a more subtle notification than an actual ringtone.
Icons
While the flashing lights, sounds, and vibrations are aimed at getting somebody to look at the device, icons are designed to take them the next step and tell them what’s so important.
To set up an icon for a , you need to set two public fields: icon, where you provide the identifier of a resource representing the icon, and , where you supply a to be raised when the icon is clicked. You should be sure the will be caught by something, perhaps your own application code, to take appropriate steps to let the user deal with the event triggering the notification.
You can also supply a text blurb to appear when the icon is put on the status bar ().
If you want all three, the simpler approach is to call , which wraps all three of those in a single call.
Дата добавления: 2015-05-16; просмотров: 782;