1. Home
  2. StayLinked Clients
  3. Running Third Party-Programs

Running Third Party-Programs

During the use of an emulation client, it may be important to open another application. This can be anything from calculator to signature capture programs. The most common methods of calling these programs include: use a ‘program call’ from the StayLinked server, from the connections list as a ‘remote program’, using a screen formatted to invoke API 12, or within screen recognition under the APIs tab. The format for these programs can vary based on the operating system and their default path.

Launching and Interacting with Third Party Applications using the SmartTE Client for Android

How to call programs on the Android device using SmartTE:

FROM THE SERVER:

  1. Administrator —> Connection List —> Right-Click —> Commands —> Execute Remote Program/Command
  2. Configure up to three ‘Program Calls’ in the Device Group and use the [call#] mnemonic in keyboard maps or scripts.
  3. Embedded StayLinked Host API
  4. Screen Recognition Host API
  5. Host Entry —> Emulation Type —> PGMCALL

FROM THE CLIENT:

  1. Use the [intent] mnemonic, from any Graphical scripting element.
  2. Use the [broadcast] mnemonic from any Graphical scripting element.
  3. Use the [execute_program] mnemonic from any Graphical scripting element to run the program configured in the execute_program Client Setting.
  4. Press the configured keycode to run the program as configured in the execute_program Client Setting.
  5. Scan a ‘Scan2Command’ barcode that contains [intent] or [broadcast] mnemonics.

The four ways to interact with applications in Android

You can launch Android Activities using the [intent] command

What are Activities?

In the most simple terms, every screen in every Android application is called an ‘Activity’. Almost all Android applications have a ‘Main Activity’ which is the first screen that you see when you launch the application from the App Icon. Most Android applications have more than one Activity (screen) and some of these are also available to be launched.

What is the [intent] command?

You can send a command to the client using the [intent] syntax to launch an available Activity (screen) on the device. Using the [intent] command syntax, you can specify which Activity to launch and you can send extra data to the Activity.

What is the syntax for [intent]?

[intent], package, class, [extra data]

  • package: This is the package containing the Activity that you want to launch.
  • class: This is the class of the Activity that you want to launch.
  • extra data: You can pass this optional extra data to an Activity that is expecting extra data.

How does the Activity access the [intent] Extra Data?

If the Activity that you are launching wants to access the extra data that is being passed, that Activity can use the Android Intent.getData() API to retrieve the extra data.

What Activities are available on my device?

As a convenience, the StayLinked SmartTE Client on Android will build for you a special file on first time startup. This special file is named ‘activities.txt’ and the Android Client will populate this file with all of the available Activities on your device.

Even more convenient, each available Activity is listed with the appropriate [intent] command syntax that can be used to launch that Activity. You can literally cut-and-paste the listed [intent] command from the ‘activities.txt’ file for use in the product.

If you install more Android Applications after the ‘activities.txt’ has been generated, then you can delete the ‘activities.txt’ file, force-close the StayLinked Client and when you relaunch the StayLinked Client, a fresh ‘activities.txt’ file will be created for you.

Different makes and models of Android Devices will have different Activities installed. The [intent] package and class that works on some models may not work on other makes or models.

You can view and/or retrieve the ‘activities.txt’ file using the ‘Administrator—>Connections List—>Right-Click—>View—>Remote File’ and enter ‘activities.txt’ as the remote file name. Then, you can select the ‘File—> Open Logs Folder’ to access the file.

Example [intent] commands that are available on a Zebra TC77 to launch Activities:

  • Calculator Activity: [intent],com.android.calculator2,com.android.calculator2.Calculator
  • Camera Activity: [intent],org.codeaurora.snapcam,com.android.camera.CameraActivity

Zebra DataWedge Settings Activity:

  • [intent],com.symbol.datawedge,com.symbol.datawedge.dwSettings

Zebra StageNow Activity:

  • [intent],com.symbol.tool.stagenow,com.symbol.tool.stagenow.main.HomeScreen

Zebra Volume Control Configuration Activity:

  • [intent],com.symbol.zebravolumecontrol,com.symbol.zebravolumecontrol.VolumeControlUI

How can I test launching Activities?

We recommend that you get your target Android Client connected to your StayLinked Server and into a live session.

Then, use the StayLinked Administrator to access the Connections->All Connections listing and find your target device.

Right-click on the target device in the Connections List and select the ‘Commands—>Execute Remote Program/Command’ menu option.

Type (or paste) the [intent] command syntax into the ‘Execute Remote Program/Command’ dialog and press the ‘Execute’ button.

Make sure your device is awake and in a live session when you follow these testing steps and you should see your desired Activity appear on the device screen.

You can broadcast Android Intents using the [broadcast] command

What are Broadcast Intents?

Some activities are designed to run in the background on the device and offer services that are accessed by other applications. A common way for applications to access these services in background applications is to broadcast an ‘intent’ to that background application. The target application running in the background will implement a ‘broadcast listener’ which has been registered with the Android OS to receive specific intents that other applications can broadcast to it.

Why would I want to broadcast an intent to another background application?

Examples of services that are offered by other applications that could be accessed by broadcast intents are:

  • An application is running in the background which reads a scale. When that ‘scale’ application receives a specific broadcast intent, it will read the scale and send the weight to the keyboard buffer.
  • An application is running in the background which controls the integrated barcode scanner. When that ‘scanner’ application receives a specific broadcast intent, it will light up the imager and read a barcode.
  • An application is running in the background which takes and records photos of damaged goods. When that ‘camera’ application receives a specific broadcast intent, it will prompt the user to take a photo of the damaged goods and then record that photo with extra data that was included in the broadcast intent.

What is the syntax for [broadcast]?

[broadcast],category,action[,extra data name=value;extra data name=value;extra dataname=value…]

  • category: The category could be a specific value used by the application for the desired service being requested. The application might use the default category of "android.intent.category.DEFAULT”. Sometimes the application does not use a category at all, so you would just put nothing between the commas. i.e; [broadcast],,action
  • action: The action will be a specific value used by the application for the desired service being requested.
  • extra data: You can optionally pass one or more ‘extra data’ name=value pairs to an application that expects extra data for the service being provided.

How do I know what Category, Action and Extra Data to broadcast to the Background Application?

Since the services provided by background applications using broadcast listeners are not required to be advertised to the Android OS, you will need to review the documentation for the background application to discover the services that are offered via broadcast intents. The documentation should specify the exact Category (if needed), Action and any required Extra Data that are used for the specific services offered.

Example [broadcast] commands that are available on a Zebra TC77 to access background application services:

  • Light up the Zebra Scanner: [broadcast],,com.symbol.datawedge.api.ACTION_SOFTSCANTRIGGER,com.symbol.datawedge.api.EXTRA_PARAMETER=START_SCANNING
    • Use the SmartTE Input API to send a Barcode Scan Input to the SmartTE Client: [broadcast],android.intent.category.DEFAULT,com.staylinked.smartte.api.INPUT,com.staylinked.smartte.api.extra.INPUT_TYPE=scan;com.staylinked.smartte.api.extra.DATA=ABC123

How can I test broadcasting intents?

We recommend that you get your target Android Client connected to your StayLinked Server and into a live session.

Then, use the StayLinked Administrator to access the Connections->All Connections listing and find your target device.

Right-click on the target device in the Connections List and select the ‘Commands—>Execute Remote Program/Command’ menu option.

  • Type the [broadcast] command syntax into the ‘Execute Remote Program/Command’ dialog and press the ‘Execute’ button.
    • Make sure your device is awake and in a live session when you follow these testing steps and you should be able to see the results of your requested service.

You can use Android reserved action prefixes to launch common activities

  • telprompt:    Launch the phone dialer activity using a command with this format:
    • telprompt:800-555-1212
    • mailto:    Launch the already configured email client and pass the email address using this format:
      • mailto:support@staylinked.com
    • http:    Launch the default browser and pass the desired URL using these formats:
      • http:\\www.staylinked.com
      • http:www.staylinked.com
    • https:    Same as the http: reserved action except this action uses a secure HTTP request using this format:
      • https:\\www.staylinked.com
      • https:www.staylinked.com

You can run Android SHELL commands

Any other command syntax sent to the StayLinked SmartTE Client on Android will be treated as a SHELL command.

SHELL commands on Android are subject to Android OS permissions restrictions and have limited usefulness.

Returning third-party program data into StayLinked

These clients create a file called activities.txt when the client starts up. This is a list of the other applications on the device at that time. You must uninstall and reinstall the client to regenerate this file, though needed applications can be called even if they are not in the activities.txt on a particular device.

You can view this file by gathering it from the Administrator’s connections list and right clicking the device. Select View > Remote File > activities.txt to get that client’s local copy.

Android

Third-Party Intent Communication

Android client can now accept a third-party intent for inter-program communication. This API is an ‘input’ intent allowing the third-party to submit using one of our standard 5 input types: scan, key, touch/tap, voice, command, and input.

Action: com.staylinked.smartte.api.INPUT
Category: Intent.CATEGORY_DEFAULT
String Extra: com.staylinked.smartte.api.extra.INPUT_TYPE

The Extra data String values for com.staylinked.smartte.api.extra.INPUT_TYPE would be one of the following:

“scan” – Send a SCAN input to the SmartTE Server
– String Extra: com.staylinked.smartte.api.extra.DATA = Barcode Data
– Integer Extra: com.staylinked.smartte.api.extra.SYMBOLOGY = eSP Symbology ID

“key” – Send a KEY input to the SmartTE Server
– String Extra: com.staylinked.smartte.api.extra.KEYCODE = 6-digit keycode

“voice” – Send a VOICE script to the SmartTE Server
– String Extra: com.staylinked.smartte.api.extra.DATA = Voice Script

“command” – Send a Mnemonic COMMAND to the SmartTE Server
– String Extra: com.staylinked.smartte.api.extra.DATA = Command Script

“touch” – Send a Mouse TOUCH Event to the SmartTE Server
– Integer Extra: com.staylinked.smartte.api.extra.ROW = Touched Row
– Integer Extra: com.staylinked.smartte.api.extra.COLUMN = Touched Column

iOS

Apple uses URL schemes. For example, tel:1-123-123-1234 would open the phone and automatically dial the phone number in the link. More information for iOS URL schemes can be found online.

Windows

Windows clients also allow the configuration of one application to be executed from the StayLinked client. This application, is configured by adding a line to the staylink.ini file similar to the example below:

execute_program=000000,[c:\windows\myprogram.exe]

For this feature to operate, the device must have the application lockdown feature enabled. The 6 digit key code can be determined using the keyboard test features, and will cause the corresponding key stroke to execute the program specified in the square brackets.

Updated on July 13, 2021

Related Articles