Reference:Android.app.Notification
From Triled Wiki
android.app
public class android.app.Notification
| java.lang.Object | ||
| android.app.Notification | Parcelable | |
A class that represents how a persistent notification is to be presented to the user using the NotificationManager.
[edit] Summary
[edit] Constants
| Value | ||||
|---|---|---|---|---|
| Creator | CREATOR | Parcelable.Creator that instantiates Notification objects |
[edit] Fields
| public | Intent | appIntent | The intent to execute when the app icon is clicked. | ||
| public | Intent | contentIntent | The intent to execute when the expanded status entry is clicked. | ||
| public | RemoteViews | expandedView | The view that shows when this notification is shown in the expanded status bar. | ||
| public | int | icon | The resource id of a drawable to use as the icon in the status bar. | ||
| public | int | iconLevel | If the icon in the status bar is to have more than one level, you can set this. | ||
| public | boolean | insistent | If true, audio and vibration will be repeated until the notification is cancelled. | ||
| public | int | ledARGB | The color of the led. | ||
| public | int | ledOffMS | The number of milliseconds for the LED to be off while it's flashing. | ||
| public | int | ledOnMS | The number of milliseconds for the LED to be on while it's flashing. | ||
| public | boolean | lights | Set to true if you want the LED on for this notification. Set to false otherwise. | ||
| public | boolean | ongoingEvent | True if this notification is in reference to something that is ongoing, like a phone call. | ||
| public | Uri | sound | The sound to play. | ||
| public | CharSequence | tickerText | Text to scroll across the screen when this item is added to the status bar. | ||
| public | long[] | vibrate | The pattern with which to vibrate. | ||
| public | long | when | The timestamp for the notification. |
[edit] Public Constructors
| Notification () | |||||
| Constructs a Notification object with everything set to 0. | |||||
| Notification (Context context, int icon, CharSequence tickerText, long when, CharSequence expandedTitle, CharSequence expandedText, Intent contentIntent, int appIcon, CharSequence appName, Intent appIntent) | |||||
| Constructs a Notification object with the information needed to have a status bar icon and the standard expanded view. | |||||
| Notification (Parcel parcel) | |||||
| Unflatten the notification from a parcel. | |||||
[edit] Public Methods
| void | writeToParcel (Parcel parcel) | ||||
| Flatten this notification from a parcel. | |||||
[edit] Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait[edit] Methods inherited from interface android.os.Parcelable
[edit] Details
[edit] Constants
[edit] public static final Creator CREATOR
Parcelable.Creator that instantiates Notification objects
[edit] Fields
[edit] public Intent appIntent
The intent to execute when the app icon is clicked.
[edit] public Intent contentIntent
The intent to execute when the expanded status entry is clicked.
[edit] public RemoteViews expandedView
The view that shows when this notification is shown in the expanded status bar.
[edit] public int icon
The resource id of a drawable to use as the icon in the status bar.
[edit] public int iconLevel
If the icon in the status bar is to have more than one level, you can set this. Otherwise, leave it at its default value of 0.
See Also
[edit] public boolean insistent
If true, audio and vibration will be repeated until the notification is cancelled.
NOTE: This notion will change when we have decided excatly what the UI will be.
[edit] public int ledARGB
The color of the led. The hardware will do its best approximation.
See Also
[edit] public int ledOffMS
The number of milliseconds for the LED to be off while it's flashing. The hardware will do its best approximation.
See Also
[edit] public int ledOnMS
The number of milliseconds for the LED to be on while it's flashing. The hardware will do its best approximation.
See Also
[edit] public boolean lights
Set to true if you want the LED on for this notification. Set to false otherwise.
- To turn the LED off, pass 0 in the alpha channel for colorARGB or 0 for both ledOnMS and ledOffMS.
- To turn the LED on, pass 1 for ledOnMS and 0 for ledOffMS.
- To flash the LED, pass the number of milliseconds that it should be on and off to ledOnMS and ledOffMS.
Since hardware varies, you are not guaranteed that any of the values you pass are honored exactly. Use the system defaults (TODO) if possible because they will be set to values that work on any given hardware.
The alpha channel must be set for forward compatibility.
[edit] public boolean ongoingEvent
True if this notification is in reference to something that is ongoing, like a phone call. False if this notification is in reference to something that happened at a particular point in time, like a missed phone call.
[edit] public Uri sound
The sound to play.
[edit] public CharSequence tickerText
Text to scroll across the screen when this item is added to the status bar.
[edit] public long[] vibrate
The pattern with which to vibrate. This pattern will repeate if insistent is true.
See Also
[edit] public long when
The timestamp for the notification. The icons and expanded views are sorted by this key.
[edit] Public Constructors
[edit] public Notification()
Constructs a Notification object with everything set to 0.
[edit] public Notification(Context context, int icon, CharSequence tickerText, long when, CharSequence expandedTitle, CharSequence expandedText, Intent contentIntent, int appIcon, CharSequence appName, Intent appIntent)
Constructs a Notification object with the information needed to have a status bar icon and the standard expanded view.
Parameters
| context | The context for your application / activity. |
|---|---|
| icon | The resource id of the icon to put in the status bar. |
| tickerText | The text that flows by in the status bar when the notification first activates. |
| when | The time to show in the time field. In the System.currentTimeMillis timebase. |
| expandedTitle | The title that goes in the expanded entry. |
| expandedText | The text that goes in the expanded entry. |
| contentIntent | The intent to launch when the user clicks the expanded notification. |
| appIcon | The icon to show for the application. |
| appName | The name of the application. |
| appIntent | The intent to launch when the user clicks the application icon. |
[edit] public Notification(Parcel parcel)
Unflatten the notification from a parcel.
[edit] Public Methods
[edit] public void writeToParcel(Parcel parcel)
Flatten this notification from a parcel.
[edit] References
- Original documentation page for Android SDK build m5-rc15e - 14 apr 2008 17:27
