Official Content

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.

Interopexternalobject-Location_png_v17u11 interopEO_png_v17u11

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.

Properties

ApplicationState property

Deprecated: Use AppLifecycle.ApplicationState instead.

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.

ScreenBrightness property

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.

Sample

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

Methods

SendMessage method

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.

Return value  None
Parameters Message:VarChar(200), To:Character(60)
 

PlayVideo method

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
 

PlayAudio method

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
 

PlaceCall method

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
 

SendEmail method

Sends a simple email through the native email client.
Check HowTo: Use SendEmail method from Interop external object.

Return value  None
Parameters To:Email, Subject:VarChar(200), Message:VarChar(200)
 

SendEmailAdvanced method

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.

Return value  None
Parameters To:Collection(Email), CC:Collection(Email), BCC:Collection(Email), Subject:VarChar(200), Message:VarChar(200), Attachment:BlobFile.
 

SendSMS method

Sends an SMS (Small Message System) to a target phone number.
Check HowTo: Use SendSMS method from Interop external object.

Return value  None
Parameters To:Phone, Message:VarChar(200)
 

Msg method

Displays a message to the end user.
Check HowTo: Use Msg method from Interop external object.

Return value  None
Parameters Message:VarChar(200), OkButtonText:VarChar(200))
 

Note: Parameter "OkButtonText" is optional and is only available from v16u9.

Confirm method

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.

Return value  Boolean
Parameters Message:VarChar(200), OkButtonText:VarChar(200)), CancelButtonText:VarChar(200)
 

Note: Parameters "OkButtonText" and "CancelButtonText" are optional and are only available from GeneXus 16 upgrade 9.

OpenInBrowser method

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
 

CanOpen method

Checks if a URL can be opened (True) or not (False).
Check Interop.CanOpen method.

Return value  Boolean
Parameters Url:URL
 

Open 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
 

ClearCache method

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
 

SetBadgeNumber method

Sets a badge number on the application icon.
Check HowTo: Use Badge operations in Apple.

Return value  None
Parameters number:Numeric(8.0)
 

IOSSetBadgeTextToTabIndex method

Sets a badge text on a tab index when using a Menu object with Control Type = Tabs.
Check HowTo: Use Badge operations in Apple.

Return value  None
Parameters text:Character(255), tabIndex:Numeric(8.0)
 

IOSSetSelectedTabIndex method

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.

Return value  None
Parameters tabIndex:Numeric(8.0)
 

ShowError method   

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.

Return value  number:Numeric(3.0)
Parameters None

OpenSettings method

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

Sample

The following code will allow going to the application notification settings.

Event "ManualSettingConfg".
  Interop.OpenSettings(MobileSettings.Application, MobileSettingsOptions.notifications)
EndEvent

OpenSettingsURL

Opens a specific URL that corresponds to a configuration screen on the device or in the application. 

Return value  None
Parameters Url:VarChar

Events

It does not have any.

Domains

ApplicationState domain

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.

Scope

Generators: Android, Apple

Availability

The OpenSettings and OpenSettingsURL methods and the MobileSettings and MobileSettingsOptions domains are available since GeneXus 18 Upgrade 4.

  

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant