HowTo: Using SendMessage from Interop in Smart DevicesOfficial Content

This tutorial is a simple and quick guide for developers that want to add behavior to their smart devices applications.

In order to add behavior, GeneXus defined the concept of Actions. By adding Actions to your Smart Device application you’ll be able to call procedures, web pages, etc.

The Actions can interact with the device through the Smart Device API.

We are going to send a message to a client using the External Objects for Smart Devices called Interop.

1. Let’s continue with our KB that we developed in  My first Apple application.

   SDApi- Transaction Country SDApi- TransactionClient

2. Before starting we should see the actions the Smart Device API offers. On KB Explorer under the Objects folder you’ll see a section named SmartDevicesApi. There you’ll see the external objects GeneXus offers to interact with the device.
   SDApi- FolderVIew

In this document we are going to focus on the Interop object.

sdapi- interop

This object has one method available: Send Message(): There are two parameters which can be configured.

  • Message: This parameter is the content of the message.
  • To: This parameter sets the recipient of the message.

3. The next step is to add the action to our application. Go to the Work With for Smart Devices object (WWSD) tab of the Transaction object Client.

     On the Events Tab of the WWSD add the following Action.

     sdai- wwsd

4. Add behaviour to the event. To go to the event just double-click on the action just created.

    To call the Interop.SendMessage() method add the following code to the event. 

Event 'Share'

     This call is made with no paramters so the Send message will be invoked with empty values.

     The action is configured:

    sdapi- interop working

5. The following are some tips of the configuration:

Priority: Can be high, normal or low. If it is a high priority action the UI element should be visible at all time. Actions with priority level normal and low  would appear on the menu.

High Priority:

Sdapi- high priority

Normal Priority:

Sdapi- normal priorit

Parameters:  as seen on step 2, this Api has two parameters that can be send when it is invoked. To set those parameters on the pattern just include them when calling the External Object on the Event. 

Note: It is a must to include in the code when calling a method all the paramters even though they are not used or have any value.

      Event 'Share'
          Interop.SendMessage('Your message here','')

             sdapi- texte here

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.