Bespot Android SDK offers indoor location tracking and analytics reporting to 3rd party apps using BLE technology and Machine Learning.
- Indoor location (in/out)
- Indoor area detection
- Outdoor location
- Analytics
Add the Bespot Artifactory repository to your root build.gradle
.
allprojects {
repositories {
maven {url 'https://bespot.jfrog.io/artifactory/bespot-sdk-android/'}
}
}
And then add the dependency in your project's build.gradle
:
dependencies {
implementation "com.bespot:library:${latest_version}"
}
First initialise Bespot SDK with the provided App Id and App Secret
Bespot.init(this, "your_app_id", "your_secret", null)
The Bespot SDK requires three permissions. It needs permission for Fine Location, for Bluetooth and for Bluetooth Admin.
In order to receive indoor location changes you need to subscribe to Bespot.subscribe
. This will return a 'StatusResult' object with the status of the device.
Bespot.subscribe(object: StatusObserver {
override fun onStatusUpdate(status: StatusResult) {
// Handle new status
}
override fun onError(error: Failure) {
// Handle error
}
}, null, null)
For the unsubscribe procedure use the Bespot.unsubscribe
override fun onPause() {
Bespot.unsubscribe()
super.onDestroy()
}
Every Observer
or Callback
class has an onError(error: Failure)
callback method that retrieves an Failure
object.
Check the error type by using the below structure:
when (error) {
is StatusFailure.NoConfigurationFound -> // No Configuration Found
is StatusFailure.NoStoreReadings -> // No Store Readings
is StatusFailure.CloseDistance -> // Close Distance"
is StatusFailure.IndoorDataModelNotFound -> // Indoor data model Not found
// Add all the Failure Cases
else -> // Unhandleable error
}
(C) Copyright 2020-2024 Bespot P.C. All rights reserved.