ProGlove Documentation

Scan2Pair

The Scan2Pair feature allows you to connect your scanner to Insight Mobile by scanning the pairing barcode.

Besides using the Insight Mobile’s built-in Scan2Pair feature, you can initiate the Scan2Pair barcode screen using the SDK or Intent.

To explore the Scan2Pair feature’s functionalities via Intent or SDK API, or to further test the API, check out the Sample app’s code in our GitHub repository.

Pair with scanner using SDK

To start the pairing process, call startPairing() on your PgManager reference. The Insight Mobile app will take over and show the paring QR code. After your device was paired with a scanner or the process was canceled by the user, your Activity will be brought back to the foreground. Your registered IScannerOutput implementations will be called according to the updated scanner state.

Pair from the pinned Activity

If your app runs inside the Android’s pinned application mode, you have to use startPairingFromPinnedActivity(activity).

activity must be an Activity running in the currently pinned task. Pairing works the same as with startPairing() but works in the pinning mode.

pgManager.connect(this.applicationContext) should still be called with the ApplicationContext. That way a scanner stays connected regardless of the Lifecycle of a single Activity.

Starting the pairing from a Background Task: Only startPairing() is able to work from a Service’s Context.

Pair with scanner using Intent

To start the scanner pairing process and show the QR activity, send a Broadcast Intent to:

  • Action: com.proglove.api.CONNECT

  • No Extras

Example 36. Intent
val intent = Intent()  
intent.setAction("com.proglove.api.CONNECT")  
sendBroadcast(intent)


Note

On Android 8 or higher, this may fail because the Insight Mobile app is not running in the background. Please start the pairing process using Insight Mobile.

Start a pairing barcode from your app

Use the following code snippet to invoke the PairingActivity with the startActivity call from within your business application:

Example 37. Intent
val component = ComponentName(“de.proglove.connect”,“de.proglove.coreui.activities.PairingActivity”)  
val launchIntent = Intent()  
launchIntent.setComponent(component)  
startActivity(launchIntent)  


Note

On starting the PairingActivity, the scanner will be disconnected (which means the user has to pair again). However, you can check beforehand if the scanner is connected or disconnected by sending an Intent to com.proglove.api.GET_SCANNER_STATE.

This can result in three different status callbacks to com.proglove.api.SCANNER_STATE:

  • Disconnected

  • Connnected

  • No response.

No response means that either the service is not running/started, or the app is not installed. In the case of no response you can still startActivity(PairingActivity) (in which case the user has to pair again).