BlueGPS SDK Examples for Android
Official Android Demo App showcases the BlueGPS SDK features and acts as reference implementation for many of the basic SDK features. Getting started requires you setup a license.
Installation
The BlueGPS Android SDK is distributed through Jitpack. It can be integrated through gradle, maven as following:
Gradle
Before you add BlueGPS depencencies, add it in your settings.gradle
at the end of repositories
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Or if you're using an older project setup, add it in your build.gradle
at the end of repositories
allprojects {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Then add the dependency for BlueGPS-SDK in the build.gradle
file for your app or module:
dependencies {
implementation 'com.github.synapseslab:android-bluegps-sdk-demoapp:<version>'
}
The version
corresponds to release version, for example:
dependencies {
implementation 'com.github.synapseslab:android-bluegps-sdk-demoapp:1.4.2'
}
Maven
Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Then add the dependency
dependency>
<groupId>com.github.synapseslab</groupId>
<artifactId>android-bluegps-sdk-demoapp</artifactId>
<version>Tag</version>
</dependency>
The Tag
corresponds to release version, for example: 1.4.2
Getting Started
Your first step is initializing the BlueGPSLib, which is the main entry point for all operations in the library. BlueGPSLib is a singleton: you'll create it once and re-use it across your application.
A best practice is to initialize BlueGPSLib in the Application class:
class App : Application() {
override fun onCreate() {
super.onCreate()
BlueGPSLib.instance.initSDK(
sdkEnvironment = Environment.sdkEnvironment,
context = applicationContext,
enabledNetworkLogs = true
)
}
}
The BlueGSP-SDK use an Environment
where integrator have to put SDK data for register the SDK and for create a communication with the BlueGPS Server see the demo app for detail. The management of the environment is demanded to the app.
object Environment {
private val SDK_ENDPOINT = "{{provided-bluegps-endpoint}}"
private val SDK_KEY = "{{provided-sdk-key}}"
private val SDK_SECRET = "{{provided-sdk-secret}}"
private val APP_ID = "com.synapseslab.demosdk"
val sdkEnvironment = SdkEnvironment(
sdkEndpoint = SDK_ENDPOINT,
appId = APP_ID,
sdkKey = SDK_KEY,
sdkSecret = SDK_SECRET,
)
}
Sample App
To run the sample app, start by cloning this repo:
git clone git@github.com:synapseslab/android-bluegps-sdk-demoapp.git
and play with it.
Examples
Authentication
BlueGPS_SDK provides a client for manage authentication and authorization inside your app.
BlueGPS MapView
Search objects
BlueGPSSDK provides some built-in capabilities to search for resources and objects within the backend.
Controllable items API
BlueGPSSDK provides a logic to interact with controllable items exposed by the backend. Controllable items could be anything that can be remote controlled by the application.
Area API
BlueGPSSDK provides some built-in capabilities for rooms and areas.
Use BlueGPS Advertising Service
Server Sent Events
The purpose of diagnostic API is to give an indication to the integrator of the status of the BlueGPS system.
- SSE Notify region changes - (documentation)
- SSE Notify position changes - (documentation)
- SSE Diagnostic Tag - (documentation)
SDK Changelog
Documentation
Let's see how you can get started with the Android BlueGPS SDK after adding the required dependencies.