- 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.
- 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 : 1→0;
2→0; 3→1→0;
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.
- 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 : 1→0;
2→0; 3→1→0;
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.
- 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 : 1→0;
2→0; 3→1→0;
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.
-
OpenNotificationSettings ()
- Show notification settings for a single app.
- SortSimpleList (List, Ascending)
- Sorts the specified list of texts.