The Interop external object (which can be found in the KB Explorer under the Smart Devices API) is used for interacting with the device using procedural programming.
You can find the Interop external object in the KB Explorer within the SD module, which in turn is located within the GeneXus module. That is, it is part of the Smart Devices API.
Indicates the current state of your application. Its values belong to the ApplicationState domain listed and described below:
Key |
Value |
Description |
0 |
Active |
The application is in the foreground or received events. |
1 |
Inactive |
The application is in the foreground but not receiving events. This can happen when an interruption occurs (eg., an incoming call) or while switching from a background state. |
2 |
Background |
The application is not in the foreground. |
Knowing the state of the application can be useful in event management scenarios (such as push notifications or event location) and to perform different actions depending on the status of implementation.
Note: On Android devices, Inactive state behavior does not exist. Therefore, in such devices, the property only acquires Active or Background values.
Gets or sets the brightness of the device screen for Android and Apple generators.
It allows you to assign a brightness value to the device. The range of values is between 0.0 and 1.0.
&Brightness = Interop.ScreenBrightness
Return value Numeric(6.2)
Notes
- In Android, the default value is -1. If this value is used, the brightness will return to the device's default.
- The brightness value will be modified as long as the screen is not changed. When the current screen is exited, it returns to the device's default brightness value.
With this sample, you can learn how to capture the brightness value of a device and if the value is less than 0.5 you can change it.
Event 'SampleBrightness'
Composite
&BrightnessVar = Interop.ScreenBrightness
If &BrightnessVar < 0.5
Interop.ScreenBrightness = 0.5
EndIf
EndComposite
Endevent
Sends a message to a contact without specifying the channel (it can be a phone number, an email address, a Facebook account, etc).
Check HowTo: Use SendMessage method from Interop external object.
Plays a video from its URI (e.g. by 'http', 'file', or 'data' schemes).
Check HowTo: Use PlayVideo method from Interop external object.
Return value |
None |
Parameters |
Video:URL
|
Plays an audio from its URI (e.g. by 'http', 'file', or 'data' schemes).
Check HowTo: Use PlayAudio method from Interop external object.
Return value |
None |
Parameters |
Audio:URL
|
Opens the defined app for making calls with the input phone number.
Check HowTo: Use PlaceCall method from Interop external object.
Return value |
None |
Parameters |
Phone:Phone
|
Sends a simple email through the native email client.
Check HowTo: Use SendEmail method from Interop external object.
Sends a more complex email through the native email client to multiple targets.
Check HowTo: Use SendEmailAdvanced method from Interop external object in Native Mobile apps.
Sends an SMS (Small Message System) to a target phone number.
Check HowTo: Use SendSMS method from Interop external object.
Displays a message to the end user.
Check HowTo: Use Msg method from Interop external object.
Note: Parameter "OkButtonText" is optional and is only available from v16u9.
Displays a message to the end user and returns True if it was confirmed or False otherwise. If the returned value has not been used, the event execution is canceled.
Check HowTo: Use Confirm method from Interop external object.
Note: Parameters "OkButtonText" and "CancelButtonText" are optional and are only available from GeneXus 16 upgrade 9.
Opens a URL in the default web browser of the device.
Check HowTo: Open a Web Page in a New Browser Window from a Smart Devices Application.
Return value |
None |
Parameters |
Url:URL
|
Checks if a URL can be opened (True) or not (False).
Check Interop.CanOpen method.
Opens a URI content using the appropriate application depending on its scheme.
For instance, 'http' scheme can open a deep link or web content in a browser, 'mailto' will open the email client, 'maps' will open the maps app, etc. Check URI scheme definition and Interop.Open method article.
Return value |
None |
Parameters |
Url:URL
|
Enables you to clear the cache on the device.
Check HowTo: Using ClearCache Method From Interop in Smart Devices Api.
Return value |
None |
Parameters |
None
|
Sets a badge number on the application icon.
Check HowTo: Use Badge operations in Apple.
Sets a badge text on a tab index when using a Menu object with Control Type = Tabs.
Check HowTo: Use Badge operations in Apple.
Selects a tab by a code indicating its index when using a Menu object with Control Type = Tabs.
Check HowTo: Use Badge operations in Apple.
Performs the equivalent of what is automatically done to display errors when a Composite command fails in a Native Mobile application.
Check HowTo: Using the ShowError method from Interop in Native Mobile applications.
Redirects the end user to a specific configuration screen on the device or in the application.
By using the MobileSettings domain, you can select between "General" and "Application" options.
- By choosing "General", the end user will be directed to the general device configuration options.
- On the other hand, selecting "Application" will take the end user to the application-specific configuration options.
Return value |
None |
Parameters |
Screen:MobileSettings, GeneXus.SD, Option:MobileSettingsOptions, GeneXus.SD |
The following code will allow going to the application notification settings.
Event "ManualSettingConfg".
Interop.OpenSettings(MobileSettings.Application, MobileSettingsOptions.notifications)
EndEvent
Opens a specific URL that corresponds to a configuration screen on the device or in the application.
Return value |
None |
Parameters |
Url:VarChar |
It does not have any.
List of possible application states.
Active |
The application is in the foreground or received events. |
Inactive |
The application is in the foreground but not receiving events. This can happen when an interruption occurs (for example, an incoming call) or while switching from the background state. |
Background |
The application is not in the foreground. |
MobileSettings |
Specify two options: "General" and "Application". |
MobileSettingsOptions |
Include options such as "Bluetooth", "Wi-Fi", "Sound", "Notifications", "Location" and others, which allow you to specify settings. |
|
Note: For Apple, the MobileSettings domain only supports the value "Application" as a valid option. For the MobileSetingsOptions domain, the only supported value is Notifications. Also, if the application never requested permissions for notifications, it will be redirected to the general notification settings, not to the application-specific ones.
Generators: Android, Apple
The OpenSettings and OpenSettingsURL methods and the MobileSettings and MobileSettingsOptions domains are available since GeneXus 18 Upgrade 4.