apidocs / com.nimmsta.core.android.device / DeviceConnectActivity

DeviceConnectActivity

class DeviceConnectActivity : PermissionActivity, NIMMSTAEventHandler

The DeviceConnectActivity is the basic activity for a NIMMSTA Scanner to Connect to the Android App. It is basically using the NIMMSTAConnectionManager.connectAsync method to connect by ConnectionCode.

It implements the following checks:

  1. Permission-Checking for location permissions
  2. Check if BLE is activated (Bluetooth Check)
  3. Regenerate and show HS50ConnectionCode by calling HS50ConnectionCode.random
  4. Start searching for the Connection code by using NIMMSTAConnectionManager.connectAsync
  5. If scanner found device, it will reflect this in the UI
  6. Error handling if something breaks
  7. It cancels searching for devices once activity hides

Author
NIMMSTA Team

Copyright
NIMMSTA GmbH & IBPG 2020

License
NIMMSTA GmbH

Constructors

<init>

The DeviceConnectActivity is the basic activity for a NIMMSTA Scanner to Connect to the Android App. It is basically using the NIMMSTAConnectionManager.connectAsync method to connect by ConnectionCode.

DeviceConnectActivity()

Functions

didConnectAndInit

fun didConnectAndInit(device: NIMMSTADevice): Unit

didStartConnecting

fun didStartConnecting(device: NIMMSTADevice): Unit

onActivityResult

fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit

onClickEnableBLE

fun onClickEnableBLE(view: View): Unit

onCreate

fun onCreate(savedInstanceState: Bundle?): Unit

onCreateOptionsMenu

fun onCreateOptionsMenu(menu: Menu?): Boolean

onDestroy

fun onDestroy(): Unit

onOptionsItemSelected

fun onOptionsItemSelected(item: MenuItem): Boolean

onPause

fun onPause(): Unit

onResume

fun onResume(): Unit

onSaveInstanceState

fun onSaveInstanceState(outState: Bundle): Unit

openLocationSettings

Opens Location settings if location services are disabled.

fun openLocationSettings(v: View): Unit

openPermissionSettings

Retries checking permissions, if got we show connect screen otherwise we go to settings to provide the user an easy way to change the permisisons.

fun openPermissionSettings(v: View): Unit

Companion Object Properties

ACTIVITY_DEVICE_LIST_RESULT

const val ACTIVITY_DEVICE_LIST_RESULT: Int

BUNDLE_CONNECT_CODE

const val BUNDLE_CONNECT_CODE: String

BUNDLE_DEVICE_ADDRESS

const val BUNDLE_DEVICE_ADDRESS: String

BUNDLE_NUMBER_RETRIES

const val BUNDLE_NUMBER_RETRIES: String

EXTRA_DEVICE_ADDRESS

const val EXTRA_DEVICE_ADDRESS: String

FINISH_ON_NEW_CONNECTION_EXTRA

const val FINISH_ON_NEW_CONNECTION_EXTRA: String

maximumQrCodeSizeDp

This is the maximum size of the QR-Code in 1/72 of an inch.

var maximumQrCodeSizeDp: Int

REQUEST_ENABLE_BT

const val REQUEST_ENABLE_BT: Int

SCAN_REFRESH_INTERVAL

val SCAN_REFRESH_INTERVAL: TimeSpan