Skip to main content

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

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

Example 36. 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

  • Connected

  • No response

Note

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 use startActivity (PairingActivity) (in which case the user has to pair again).

For special cases, you can modify the default pairing behavior using the following Extras:

Extra key

Value type

Description

Default value

restartable_extra

Boolean

Allows the Android device to re-initiate the Pairing process.

true

advertising_name_extra

String

User-defined advertising name.

10 random characters (max length)

time_out_in_ms_extra

Long

If no activities are recorded during this timeframe after pairing your ProGlove scanners, the connection will time out automatically.

60000 (milliseconds)

Note

The default value of time_out_in_ms_extra should not be changed to maintain stability in pairing process.