Receive Button events
The Insight Mobile app sends a Button event when the button is pressed twice in quick succession (like a double-click on a computer mouse).
To receive this event, register a callback object via SDK or listen for broadcast Intents of the following structure:
Action:
com.proglove.api.DISPLAY_BUTTON
Extras:
String in
com.proglove.api.extra.DISPLAY_BUTTON
contains the ID of the pressed button
override fun onCreate(savedInstanceState: Bundle?) { //... pgManager.subscribeToButtonPresses(this) //... } override fun onDestroy() { super.onDestroy() pgManager.unsubscribeFromButtonPresses(this) } // To do this, our Activity needs to implement the `IButtonOutput` interface: // // -- IButtonOutput -- // override fun onButtonPressed(buttonPressed: ButtonPress) { // the button presses will come on background threads, make sure to execute this on the UI Thread runOnUiThread { Toast.makeText(this, "Got a button Press: ${buttonPressed.id}", Toast.LENGTH_SHORT).show() } }
// 1 Implement a broadcast receiver (in this case the class is called MessageHandler): class MessageHandler : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { if (intent != null && intent.action == "com.proglove.api.DISPLAY_BUTTON") { intent.getStringExtra("com.proglove.api.extra.DISPLAY_BUTTON") } } } // 2 define an IntentFilter filtering for the specified actions: val messageHandler: MessageHandler = MessageHandler() val filter = IntentFilter() filter.addAction("com.proglove.api.DISPLAY_BUTTON") filter.addCategory(Intent.CATEGORY_DEFAULT) // 3 Somewhere where a context is available (usually an Activity's or Service's onCreate): context.registerReceiver(messageHandler, filter) // Do not forget to unregister the receiver again, for example in onDestroy: context.unregisterReceiver(messageHandler)
How to receive Button events for Ivanti’s Velocity browser
You can configure the button trigger to send a barcode Intent to the integrated Ivanti’s Velocity browser on double-click in order to send notifications to the worker’s MARK Display scanner.
To enable this event:
On Insight Webportal , under Device Visibility, select Configurations.
The list of existing configurations displays.
At the top right, click the icon to add a configuration.
Note
You can also click the pencil icon next to an existing configuration to modify it.
Select Insight Mobile (Android) and click Next.
Under Workflow Rules, click Add Rule.
Under Trigger, select Button Double-Trigger.
Under Action, select Output via Intent.
Click Save Action and then Save Rule.
Click Next.
The Assign a Name for the Configuration modal window displays.
Type in the name of your configuration and click Next.
Scan the configuration barcode to apply the configuration to your Android device.
Note
You can also download the configuration and import it manually.
Receiving this event can be done by listening for broadcast Intents of the following structure:
Action:
com.wavelink.intent.action.BARCODE
Extras:
com.proglove.api.extra.BARCODE_DATA
=“BUTTON_PRESSED”com.proglove.api.extra.BARCODE_SYMBOLOGY
=“SPECIAL_BUTTON”String in
com.proglove.api.extra.DISPLAY_BUTTON
contains the ID of the pressed button
Make sure you filter the incoming Intents by this data to distinguish it from normal scans.