Get Started
After importing the plugin, make sure that the project has this folder structure:
Creating the Managers
You can add the plugin to your Scene by adding the “NextNavInterface” prefab in your scene which is located here:
The prefab has the main script, “NextNavInterface” that automatically handles the current platform based on your context (Android or iOS) and receives the calls that are then passed to the specific native SDKs (NextNavAndroid script or NextNaviOS script).
Methods
Here’s the list of Methods available through the NextNavInterface:
Method | Description |
200 | Successful assistance data delivery, including HAE, HAT and uncertainty data |
void InitSdk() | This will Initialize the plugin |
string StartAltitudeCalculationOnce() | Get altitude data only once (Only Android) |
string StartAltitudeCalculationEachSecond() | Get altitude data every second |
string StartAltitudeCalculationEvery30Second() | Get altitude data every 30 seconds |
string StartAltitudeCalculationEvery60Second() | Get altitude data every 60 seconds (Only Android) |
void StopAltitudeCalculation() | Stop the current altitude calculation |
void ShowCalibrationUI() | Launch the calibration screens |
void Stop() | Turns off the plugin |
void Callback(string stringData) | This method handles all the communication received from iOS or Android environment |
void CallbackStatus(Constants.SdkStatus status, int statusCode) | Here you can handle the status and status code received |
void CallbackData(string heightHat, string heightUncertaintyHat, string height, string heightUncertainty) | Here you can handler the differents heights received |
void CallbackError(string error) | Here you can handler the error occurred |
void RequestPermissions() | Request permissions in android context (you can enable the auto request permissions boolean to avoid calling it manually and it will be triggered at the start of the app) |
void SetDeveloperKey(string key) | You can set the developer key before calling the Init method |
void SetHostURL(string hostURL) | You can set the Host Url before calling the Init method |
void Start2DLocationInjection(string latitude, string longitude) | You can start an altitude calculation using latitude and longitude. |
NOTE:
- When you use Start2DLocationInjection method, the plugin will no longer automatically fetch 2D location from the device for altitude calculation.
- You must ensure that the injected location value is updated as needed by calling the StopAltitudeCalculation function followed by a fresh Start2DLocationInjection function call with a new 2D location data.
- The location data may become stale if the device moves and the injected 2D Location is not refreshed.
Callback methods
You can receive three types of Callback methods from the SDK: “SDK_Status”, “Data” or “Error”
- SDK_Status: In this case you will receive a status code. This triggers the CallbackStatus() method in the NextNavInterface script, so you can add your code there.
- Data: Here you can access the heights values: “Height HAT” “Height HAT Uncertainty” and the “Timestamp” of each height received. This triggers the CallbackData() method in the NextNavInterface script, so you can add your code there.
- Error: Will give you the error description. This triggers the CallbackError() method in the NextNavInterface script, so you can add your code there.
Setting the Developer Key and Host Url
Please refer to page 3 for information related to obtaining a developer key. Once you have acquired a developer key, just add it in the Key field in the NextNavInterface inspector (if you are in the demo scene you will need to add it in the NextNavInterfaceDemo script too).
You need to do this before calling the InitSdk method, otherwise the SDK will fail to initialize.
Host URL:
The parameter “baseURL” is the NextNav service environment URL, developers should use “api.nextnav.io” during the evaluation phase. When the application is ready to be launched, the commercial services agreement for this application will provide the final “baseURL” and “secretKey” for commercial purposes. Please email pinnacle.support@nextnav.com for any additional questions related to these parameters.
Setting the Google Maps Key (Optional)
In order for Calibration and Altitude to work, the SDK needs to be able to display a Map and be updated with Latitude and Longitude values.
Android
The Plugin is already configured to utilize Google Maps, but developers must provide their own key.Getting a Google Maps Key is totally free and more information can be found here: https://developers.google.com/maps/documentation/geocoding/get-api-key. After obtaining the Key, follow the steps below.
Start by changing the metadata in the android manifest file located here:
Add your google api key in the android:value”Api key here”. Additionally, make sure that your Google Maps Api Key (Step 09 – Create Google Api Key for more info about this) has “Android SDK” enabled in the Google Developer Console. See Section 9 for Reference.
iOS
(if you use apple maps, this is not necessary)
Start by opening the NNGoogleMapsManager.swift file located in this path:
And add the Google Maps Api Key here and make sure that your Google Maps Api Key has iOS SDK” enabled (Step 09 – Create Google Api Key for more info about this) in the Google Developer Console. See Section 9 for Reference.xyLocation: