Sensorberg Smart Spaces SDK for Android / com.sensorberg.smartworkspace.sdk / AbstractNfcActivity

AbstractNfcActivity

abstract class AbstractNfcActivity : AppCompatActivity, TapEventListener

Abstract class for receiving NFC Intents.

If you wish to receive NFC Intents elsewhere you're free to do so, just make sure you always pass them to SmartWorkspaceSdk.processNfcIntent

To implement:

  1. Add this Activity to your Manifest file with intent filter: <intent-filter> </intent-filter>
  2. Override getSdk to provide your instance of SmartWorkspaceSdk
  3. Provide your UI (if any) by overriding onCreate method and calling setContentView If you don't provide any UI it will still fire onPause/onResume events on your Activity below.
  4. Override onTapEvent and onNfcIntent. One of those is guaranteed to be called.
  5. This activity will finish immediately when processing is done. (Sometimes before onResume) If you wish to keep it for longer override canFinish and return false.

This implementation awaits until both:

If you're not sure what is host/scheme for your installation:

Constructors

<init>

AbstractNfcActivity()

Abstract class for receiving NFC Intents.

Functions

getSdk

abstract fun getSdk(): SmartWorkspaceSdk

Provide SmartWorkspaceSdk instance here

onCreate

open fun onCreate(savedInstanceState: Bundle?): Unit

onNfcIntent

abstract fun onNfcIntent(intent: Intent?): Unit

Delivers source NFC Intent when generating onTapEvent wasn't possible. Situations when this can happen are caused by:

onPause

open fun onPause(): Unit

onTapEvent

abstract fun onTapEvent(openable: Openable): Unit

Delivers Openable when NFC event is detected. Activity will be finished immediately after this call.