Deutsche Version   Deutsche Version


Note:
The Title and Text parameters accept HTML tags. This is not mentioned in the description of the individual elements. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.

Reference UrsAI2NotificationChannel

Properties

BypassDnd
Specifies whether notifications sent to this channel can interrupt the user in NotificationManager.INTERRUPTION_FILTER_PRIORITY mode. The default is false.
ChannelID
The ID of the channel. The ID must be unique for each app. The value can be cut off if it is too long. The default setting is "UrsNotificationChannel".
ChannelName
The name of the channel visible to the user. The default setting is "Urs Notification Channel".
This value can be changed afterwards.
Description
The description of this channel visible to the user.
This value can be changed afterwards.
Importance
Specifies the importance of the channel. The default is NotificationManager.IMPORTANCE_DEFAULT.
LightColor
If supported by the device, specifies the color of the optical signal. The default setting is "transparent".
LightEnabled
Sets whether notifications posted to this channel should display notification lights, on devices that support that feature.
Note: The LED is only switched on when the display is switched off. The default is false.
LockscreenVisibility
Sets whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form:
ShowBadge
Sets whether notifications posted to this channel can appear as application icon badges in a Launcher.  The default setting is false.


SoundEnabled
Specifies whether the default sound should be played for notifications sent to this channel  (s.o.). The default setting is false.
Version
Gets the version of the extension.
VersionSDK
The SDK version of the software currently running on this hardware device.
VibrationEnabled
Sets whether notification posted to this channel should vibrate. (s.o.). The default setting is false.
VibrationPattern
Specifies the vibration pattern for notifications sent to this channel, a comma-separated list of milliseconds, starting with the pause time (s.o.).

If the pattern cannot be resolved, the Screen.ErrorOccurred event is triggered with ErrorNumber 17002 when the app is started. The channel is not created!

Functions

AppIsAlreadyRunning()
Checks whether another instance of the app is already active. Depending on the situation, tapping a notification opens a second instance of the app, This function checks for an already running app. This function does not work in the Companion.
Cancel (NumberID)
Cancels a single notification. Notifications associated with a ForegroundService are not canceled  (see UrsKeepAlive). NumberID: ID of the notification.
CancelAlarm (RequestCode)
Cancels an alarm that has not yet been triggered. RequestCode: Unique numeric ID for this alarm.
CancelAll ()
Cancels all notifications from the app. Notifications associated with a ForegroundService are not canceled  (see UrsKeepAlive).
CloseSystemDialogs ()
Closes the notification panel.
CreateActionNotification (NumberID, Icon, Title, Text, AutoCancel, UrsIntentObject)
Creates a simple notification. When the user taps the notification, the intent transferred in the UrsIntentObject is executed. NumberID: unique ID of the notification. Icon: small icon that should be displayed (either the name of an asset file (since API level 23) or the name of a system icon). Title: first line of the notification (bold). Text: second line. AutoCancel: The notification disappears when the user taps it.

If a second notification is created with the same ID before the previous one has been canceled, this will be updated.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.
CreateAiNotification (NumberID, Icon, Title, Text, ScreenToOpen, StartValue, AutoCancel)
Creates a notification that, when tapped, opens the AI2 app that  created the notification. NumberID: unique ID of the notification. Icon: small icon that should be displayed (either the name of an asset file (since API level 23) or the name of a system icon). Title: first line of the notification (bold). Text: second line. ScreenToOpen: name of the screen that should be opened when the notification is tapped. If ScreenToOpen is left blank, "Screen1" is used. StartValue: Start value that can be read from the opened screen. AutoCancel: The notification disappears again when the user taps it.

ScreenToOpen can either be a screen name of the app or the fully classified class name of any activity.

If the screen to be called or the activity class cannot be found, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17004.

If StartValue remains empty, "NOTIFICATION" + <NumberID> is used.

The Intent to be executed is provided with these flags: FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_MULTIPLE_TASK, FLAG_ACTIVITY_NO_ANIMATION
CreateAlarm (RequestCode, Delay, Type, WakeUp, UrsNotificationObject, UrsIntentObject)
Creates a delayed notification. RequestCode: Unique numeric ID for this alarm. Delay: Delay in seconds. Type: indication of the accuracy. WakeUp: Wakes up the device when the time has expired. UrsNotificationObject: defines the properties of the notification to be created at the time of the alarm. UrsIntentObject: defines what action is executed when the notification is tapped.

Type has the values 0..3. These methods are called depending on Type:

  • 0: AlarmManager.set (since API Level 1)
    As of API 19, the trigger time passed to this method is treated as imprecise: the alarm is not sent before this time, but can be postponed and sent some time later.
  • 1: AlarmManager.setExact (since API Level 19) The alarm is triggered as close as possible to the desired time.
  • 2: AlarmManager.setAndAllowWhileIdle (ab API Level 23) This alarm is also triggered when the system is in doze mode.
  • 3: AlarmManager.setExactAndAllowWhileIdle (ab API Level 23)
    The alarm is triggered as close as possible to the desired time and is also triggered when the system is in doze mode.

If the current API level is not sufficient, the type is adapted : 10; 20; 310;

If the value for Delay is less than zero, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17007.

If the object specified in the UrsNotificationObject parameter is not of the UrsNotification type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17005.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.

CreateAlarmAt (RequestCode, Millis, Type, WakeUp, UrsNotificationObject, UrsIntentObject)
Creates a notification to be displayed at time defined by Millis. RequestCode: Unique numeric ID for this alarm. Millis: the time of the alarm in milliseconds since 1.1.1970. Type: indication of the accuracy. WakeUp: Wakes up the device when the time has expired. UrsNotificationObject: defines the properties of the notification to be created at the time of the alarm. UrsIntentObject: defines what action is executed when the notification is tapped.

Type has the values 0..3. These methods are called depending on Type:

  • 0: AlarmManager.set (since API Level 1)
    As of API 19, the trigger time passed to this method is treated as imprecise: the alarm is not sent before this time, but can be postponed and sent some time later.
  • 1: AlarmManager.setExact (since API Level 19) The alarm is triggered as close as possible to the desired time.
  • 2: AlarmManager.setAndAllowWhileIdle (ab API Level 23) This alarm is also triggered when the system is in doze mode.
  • 3: AlarmManager.setExactAndAllowWhileIdle (ab API Level 23)
    The alarm is triggered as close as possible to the desired time and is also triggered when the system is in doze mode.

If the current API level is not sufficient, the type is adapted : 10; 20; 310;

The value for Millis can be obtained from a clock component using the GetMillis method.

If the value for Millis is less than the current system time, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17008.

If the object specified in the UrsNotificationObject parameter is not of the UrsNotification type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17005.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.

CreateAlarmEx (RequestCode, Delay, Type, WakeUp, UrsNotificationObject, UrsIntentObject)
Creates a delayed notification. The time at which the notification is generated is returned. RequestCode: Unique numeric ID for this alarm. Delay: Delay in seconds. Type: indication of the accuracy. WakeUp: Wakes up the device when the time has expired. UrsNotificationObject: defines the properties of the notification to be created at the time of the alarm. UrsIntentObject: defines what action is executed when the notification is tapped.

The return value is the alarm time in milliseconds since 1.1.1970. This value can e.g. be transferred to the MakeInstantFromMillis method of a Clock component to create a readable date-time format.

Type has the values 0..3. These methods are called depending on Type:

  • 0: AlarmManager.set (since API Level 1)
    As of API 19, the trigger time passed to this method is treated as imprecise: the alarm is not sent before this time, but can be postponed and sent some time later.
  • 1: AlarmManager.setExact (since API Level 19) The alarm is triggered as close as possible to the desired time.
  • 2: AlarmManager.setAndAllowWhileIdle (ab API Level 23) This alarm is also triggered when the system is in doze mode.
  • 3: AlarmManager.setExactAndAllowWhileIdle (ab API Level 23)
    The alarm is triggered as close as possible to the desired time and is also triggered when the system is in doze mode.

If the current API level is not sufficient, the type is adapted : 10; 20; 310;

If the value for Delay is less than zero, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17007.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.

CreateNotification(UrsNotificationObject, UrsIntentObject)
Creates a notification. UrsNotificationObject: defines the properties of the notification. UrsIntentObject: defines what action is executed when the notification is tapped.

If the object specified in the UrsNotificationObject parameter is not of the UrsNotification type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17005.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.
CreateProgressNotification(CurrentProgress, MaxProgress, Indeterminate, UrsNotificationObject, UrsIntentObject)
Creates a notification that shows the progress of completion of a running process (e.g. a dwonload) (see Add a progress bar). In the case of an indeterminate progress bar, a bar moves from left to right again and again. Otherwise the length of the bar is displayed corresponds to CurrentProgress (in relation to MaxProgress).

CurrentProgress: current progress (irrelevant at Indeterminate Progress Bar) MaxProgress: Value when fully completed. Indeterminate: true: a running bar is displayed ; false: a progress bar with a length proportional to CurrentProgress is displayed. UrsNotificationObject: defines the properties of the notification to be created at the time of the alarm. UrsIntentObject: defines what action is executed when the notification is tapped.

The progress bar can be adjusted using the UrsNotification.SetProgress and UrsNotification.SetProgressEx methods.

If the object specified in the UrsNotificationObject parameter is not of the UrsNotification type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17005.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.
CreateSimpleNotification (NumberID, Icon, Title, Text)
Creates a simple notification with no action. NumberID: unique ID of the notification. Icon: small icon that should be displayed. Icon is either the name of an uploaded graphic (since API level 23) or the name of a system icon. Title: first line of the notification (bold). Text: second line.

The AutoCancel attribute is set. This means that the notification disappears when the user taps the message.

If a second notification is created with the same ID before the previous one has been deleted, the first one will be updated.
GetActiveNotifications()
Returns a list with the IDs of the active notifications.
HideChannel ()
Hides the channel.  Since API Level 26!
If a new channel is created with the same ID, the deleted channel will be restored with all the settings it had before it was deleted.
MoveOtherAppToFront ()
Brings another instance of the app that is already running to the foreground. This function does not work in the Companion.
OpenHomeScreen ()
Puts the app in the background and opens the home screen. It simulates pressing the home button.
OpenNotificationPanel ()
Opens the notification panel.

This function requires the EXPAND_STATUS_BAR permission. This permission is not requested in the standard AI2 companion. The function does not work there. Chapter Patching the AI2 Companion - additional permissions explains how to patch the AI2 Companion and how to obtain the necessary permission.
SortSimpleList (List, Ascending)
Sorts the specified list of texts.