Skip to content

Instantly share code, notes, and snippets.

@MrCrambo
Last active July 11, 2020 07:53
Show Gist options
  • Save MrCrambo/3e551d8d9727e4fa6d3fdff0a98dafae to your computer and use it in GitHub Desktop.
Save MrCrambo/3e551d8d9727e4fa6d3fdff0a98dafae to your computer and use it in GitHub Desktop.
/*
Initialize the NavigineSDK and load your location
*/
NavigineSDK.initialize(mContext, USER_HASH, SERVER_URL);
NavigineSDK.loadLocationInBackground(D.LOCATION_NAME, 30, mLoadListener); // Loading with Location.LoadListener callback
LocationView locationView = findViewById(R.id.locationView);
...
/*
After the location is loaded, you could set it to LocationView element
and could add Listener and OnLayoutChangeListener
In this listeners will happen redrawing of the location and will habdle touch events
*/
...
// Get the NavigationThread class
mNavigation = NavigineSDK.getNavigation();
/*
Set device listener for getting updates about your position in the location
you will get results every second.
So you can provide the custom signals after you get the device info, for getting navigation in next updates
But we recommend to provide it in another function,
because you could want to provide a lot of signals
*/
mNavigation.setDeviceListener(new DeviceInfo.Listener(){
@Override public void onUpdate(DeviceInfo info) {
handleDeviceUpdate(info);
}
});
...
// Do not forget to set the navigation mode to normal for getting navigation without pauses
mNavigation.setMode(NavigationThread.MODE_NORMAL);
...
/*
You need to create your Beacon creater function for generating new beacons
with the uuid, major, minor you need in your location
And in your beacon creater function you should provide the data to the navigation thread
*/
mNavigation.provideBluetoothMeasurement(name, address, rssi, scanRecord);
/*
And also you could create the function for generating wifi signals
and add the same function for providing this data to the navigaiton
*/
mNavigation.provideWifiMeasurement(scanResults);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment