You are reading 13.2.0. See this page in 13.4.1.
Titanium.Android.NotificationChannel
Extends Titanium.Proxy
Module for notification channels.
You can create a notification channel for each distinct type of notification you need to send.
To create a notification channel, use the Titanium.Android.createNotificationChannel method.
Further Reading:
Examples
Notification Channel Example
The following example shows how to create a notification with a channel.
var channel = Ti.Android.NotificationManager.createNotificationChannel({
id: 'my_channel',
name: 'TEST CHANNEL',
importance: Ti.Android.IMPORTANCE_DEFAULT
}),
notification = Ti.Android.createNotification({
icon: Ti.Android.R.drawable.ic_dialog_info,
contentTitle: 'TITLE',
contentText : 'This is a test',
channelId: channel.id
});
Ti.Android.NotificationManager.notify(100, notification);
Properties 16
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
bypassDnd
BooleanWhether or not notifications posted to this channel can interrupt the user.
description
StringUser visible description of this channel.
enableLights
BooleanWhether notifications posted to this channel should display notification lights
enableVibration
BooleanWhether notification posted to this channel should vibrate.
groupId
StringGroup id this channel belongs to.
id
StringThe channel id specified for the notification channel.
importance
NumberThe audio stream type to use when playing the sound.
Specify one of the IMPORTANCE constants from Titanium.Android.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
lightColor
NumberThe notification light color for notifications posted to this channel.
lockscreenVisibility
NumberWhether or not notifications posted to this channel are shown on the lock screen in full or redacted form.
name
StringThe visible name of this channel. The recommended maximum length is 40 characters; the value may be truncated if it is too long.
showBadge
BooleanWhether notifications posted to this channel can appear as application icon badges in a Launcher.
A URL to the sound to play.
The URL cannot refer to a file in the Resources directory, but it can refer to a file in the raw resources directory (Filesystem.resRawDirectory).
To create a raw resource, place the audio file in the platform/android/res/raw
folder and reference it as:
notificationChannel.sound = Ti.Filesystem.resRawDirectory + 'my_sound.wav';
vibratePattern
Array<Number>The vibration pattern for notifications posted to this channel.
Specify the pattern in milliseconds as an array. (e.g [100, 100, 100, 400, 400, 100, 100, 100])
Methods 4
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|