A demonstration Android application showcasing the integration of NextBillion Maps and Navigation SDKs using Jetpack Compose.
This project demonstrates how to implement a navigation application using NextBillion's SDKs with modern Android development practices:
- Jetpack Compose for UI
- Maps Component for interactive maps
- Navigation Component for screen navigation
- Material 3 design system
- Kotlin-first approach
- Interactive map with location tracking
- Route planning and visualization
- Turn-by-turn navigation
- Multiple navigation examples:
- Basic navigation
- Parameter passing
- Navigation launching and callback listener
- Android Studio Arctic Fox (2020.3.1) or newer
- JDK 8 or newer
- JVM 11
- Android Gradle Plugin 8.0+
- Android SDK with API level 34
- NextBillion API key
- Clone the repository
- Open the project in Android Studio
- Add your NextBillion API key to the project:
- Replace your API key in the
DemoApplication
class:Nextbillion.getInstance(context, "YOUR_API_KEY")
- Replace your API key in the
- Sync the project with Gradle files
- Run the application on an emulator or physical device
The following permissions need to be declared in the AndroidManifest.xml
:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
-
Navigation Activity Requirements:
- If you're using
NBNavigationView
as a navigation component, the activity must extendFragmentActivity
- Example:
class NavigationActivity : FragmentActivity(), NavigationListener, RouteListener { ... }
- If you're using
-
Activity Configuration:
- For activities that host navigation, add the following to the
AndroidManifest.xml
:
android:configChanges="orientation|screenSize|keyboardHidden"
- For activities that host navigation, add the following to the
app/src/main/java/ai/nextbillion/compose/example/
navigation/
- Navigation graph and routesscreens/
- Compose UI screensui/
- UI components and themeutils/
- Utility classesviewModel/
- ViewModels for state management
-
NextBillion SDKs:
nb-navigation-compose:2.0.2
nb-maps-compose:1.1.5
nb-navigation-android:2.0.2
-
AndroidX and Compose:
- Navigation Compose
- Material 3
- ConstraintLayout Compose
- CardView
- Launch the application
- Select a navigation example from the home screen
- For the map example:
- Long press on the map to set a destination
- View the calculated route
- Start navigation by tapping on the route


- API Key: Verify your API key is correctly set in the
DemoApplication
class - Permissions: Ensure all required permissions are granted at runtime for Android 6.0+
This project is licensed under the MIT License - see the LICENSE file for details.
- NextBillion for providing the Maps and Navigation SDKs
- Android team for Jetpack Compose and other modern Android libraries