-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Table Contents:
Overview
Requirements
App Permission
Integrate MistSDK
Initialize MistSDK
Getting Location Info
Lat/Long coordinate
Sample Apps
Documentation for MistSDK callbacks
Release Notes
Mist provides indoor blue dot navigation experience with 16 vBLE antenna array in Mist Access Point. This guide will provide detailed information on our Android SDK. It will help you configure application to integrate Mist SDK and initialize location services.
MistSDK DR uses dead reckoning approach to calculate user’s current position by using a previous position and advancing that position based on known and estimated speeds over elapsed time. Meaning DR is designed to take all location information available that a user had when connected and work the same as though the client is connected, even when experiencing a disconnect or blimp in the connection.
Mist android vBLE SDK supports following features:
1. Zones and vBLE events callbacks .
2. Background Mode .
3. App Wake Up .
4. Maps Supported .
- Android Studio: 3.0 or later
- Minimum Android SDK: API 21
- Target Android SDK: API 28
- Latest Mist SDK
- Mist AP wireless network infrastructure
- BLE enabled android device
- Access to Mist Account
Mist SDK will require bluetooth and location services to function on your device. Declare the following permission(s) in your application manifest file. For example:
<manifest ... >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
...
</manifest>
MistSDK can be integrated by using one of the following ways in your android app project:
Add the following in your app module build.gradle, This will take care of both Mist Core SDK and DR SDK
implementation 'com.mist:core-sdk:2.0.110'or
While manually setting up SDK, include both 'Mist Core SDK' and 'DR SDK' in you application project.
- Download mistsdk-framework.aar' and 'mist-mobile.aar' from SDK Releases
- Add following to app/build.gradle in dependencies
implementation(name:'mistsdk-framework', ext:'aar')
implementation(name:'mist-mobile', ext:'aar')
implementation fileTree(include: ['*.jar'], dir: 'libs')In project/build.gradle, add following in repositories
flatDir { dirs 'libs'}If your app is targeting API level 28 (Android 9.0) or above, you must include the following declaration within the element of AndroidManifest.xml.
<uses-library android:name="org.apache.http.legacy" android:required="false" />
Add the following in App/build.gradle, to implement the web socket dependencies:
implementation "org.java-websocket:Java-WebSocket:1.4.0"
For more details please refer to one of the Sample Apps
To initialize Mist SDK you need organization secret and organization id.
- Obtain the invitation for Mobile SDK secret(sdktoken) from the Mist portal at the following path: Organization -> Mobile SDK -> secret.
[Refer FAQs: where can I find my secret key?]
Use the sdktoken to obtain the org_id and secret via onReceivedSecret callback method from MSTOrgCredentialsManager:
MSTOrgCredentialsManager.enrollDeviceWithToken(mApp.get(), sdkToken, this); @Override
public void onReceivedSecret(String orgName, String orgID, String sdkSecret, String error, String envType) {
if (!TextUtils.isEmpty(sdkSecret) && !TextUtils.isEmpty(orgID) && !TextUtils.isEmpty(sdkSecret)) {
saveConfig(orgName, orgID, sdkSecret, envType);
connect(indoorOnlyListener, this.advanceListener, appMode);
} else {
if (!Utils.isEmptyString(error)) {
if (indoorOnlyListener != null) {
indoorOnlyListener.onMistErrorReceived(error, new Date());
}
}
}
}- Use the org_id and secret to initialize the MSTCentralManager. To use the location methods, implement the MSTCentralManagerIndoorOnlyListener and MistLocationAdvanceListener.
-
MSTCentralManagerIndoorOnlyListener is used to fetch x, y coordinates, map details, vBeacons list, zone and vBeacon notifications.
-
MistLocationAdvanceListener provides advance callbacks to fetch the Lat/Lon, Speed and direction along with relative x, y coordinate.
mstCentralManager = new MSTCentralManager(mApp.get(), orgData.getOrgId(), orgData.getSdkSecret()); mstCentralManager.setMSTCentralManagerIndoorOnlyListener(indoorOnlyListener); mstCentralManager.setMistLocationAdvanceListener(advanceListener);
- Call start API of MSTCentralManager to start the SDK:
mstCentralManager.start();- Call stop on MSTCentralManager to stop receiving callbacks from Mist SDK:
mstCentralManager.stop();- Map Information: Map details such as mapId, mapName, mapImageURL, mapOrigin, width and height are received in onMapUpdated Callback. This method is called to load the new map or update the map while switching floors and sites.
void onMapUpdated(MSTMap map, Date dateUpdated)MSTMap object contains following Mist map information:
mapName
mapId
mapImageURL
mapType
mapOrigin
mapScale
mapWidth and mapHeight
ppm (pixel per meter)
- Location Information: Location response is used to know the position of the user in that particular floorplan. To get location information from Mist SDK implement MSTCentralManagerIndoorOnlyListener callbacks in your application. Following method returns updated location of the device as an MSTPoint object (X, Y) measured in meters from the map origin:
void onRelativeLocationUpdated(MSTPoint var1, MSTMap[] var2, Date var3);MSTPoint object contains the following user information:
- x, y: user location
- hasMotion: is the user in motion,
- mstPointType: type Cloud,
- latency: latency in the network,
- heading: compass heading,
- headingFlag: availability of compass heading
To get Lat/Lon information along with x/y from the SDK, you need to implement MistLocationAdvanceListener callbacks in your application. Following method returns the Lat/Lon.
void onDRRelativeLocationUpdated(JSONObject var1, MSTMap var2, Date var3);
The latitude and longitude coordinate can be found inside the JSONObject.
{
"Raw": {
"Heading": -180,
"Lat": 36.562600,
"Lon": -118.957490,
"Speed": 1.152899
},
"Snapped": {
"Heading": -180,
"Lat": 36.562600,
"Lon": -118.957490,
"Speed": 1.152899
}
}For more detail, you can see the implementation in the sample app here.
For more callback related information refer Mist SDK callbacks page .
Check what's new in the release notes
For further questions please reach out to support@mist.com
