Skip to content

Commit fc111d1

Browse files
[Android Auto] App for testing stable versions (#6605)
* Android auto app for testing stable versions * Update android-auto-app/build.gradle Co-authored-by: Abhishek Kejriwal <abhishek.kejriwal@mapbox.com> Co-authored-by: Abhishek Kejriwal <abhishek.kejriwal@mapbox.com>
1 parent 5cdc300 commit fc111d1

41 files changed

Lines changed: 1005 additions & 179 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,12 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
38153815

38163816
===========================================================================
38173817

3818+
Mapbox Navigation uses portions of the Android DB.
3819+
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
3820+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
3821+
3822+
===========================================================================
3823+
38183824
Mapbox Navigation uses portions of the Android for Cars App Library (Build navigation, parking, and charging apps for Android Auto).
38193825
URL: [https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)
38203826
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -3839,12 +3845,24 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
38393845

38403846
===========================================================================
38413847

3848+
Mapbox Navigation uses portions of the Android Lifecycle Process.
3849+
URL: [https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)
3850+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
3851+
3852+
===========================================================================
3853+
38423854
Mapbox Navigation uses portions of the Android Lifecycle Runtime.
38433855
URL: [https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)
38443856
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
38453857

38463858
===========================================================================
38473859

3860+
Mapbox Navigation uses portions of the Android Lifecycle Service.
3861+
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
3862+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
3863+
3864+
===========================================================================
3865+
38483866
Mapbox Navigation uses portions of the Android Lifecycle ViewModel.
38493867
URL: [https://developer.android.com/jetpack/androidx/releases/lifecycle#2.3.1](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.3.1)
38503868
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -3893,6 +3911,18 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
38933911

38943912
===========================================================================
38953913

3914+
Mapbox Navigation uses portions of the Android Room-Common.
3915+
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
3916+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
3917+
3918+
===========================================================================
3919+
3920+
Mapbox Navigation uses portions of the Android Room-Runtime.
3921+
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
3922+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
3923+
3924+
===========================================================================
3925+
38963926
Mapbox Navigation uses portions of the Android Support AnimatedVectorDrawable.
38973927
URL: [https://developer.android.com/jetpack/androidx](https://developer.android.com/jetpack/androidx)
38983928
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -3983,6 +4013,12 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
39834013

39844014
===========================================================================
39854015

4016+
Mapbox Navigation uses portions of the Android Support SQLite - Framework Implementation (The implementation of Support SQLite library using the framework code.).
4017+
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
4018+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
4019+
4020+
===========================================================================
4021+
39864022
Mapbox Navigation uses portions of the Android Support VectorDrawable.
39874023
URL: [https://developer.android.com/jetpack/androidx](https://developer.android.com/jetpack/androidx)
39884024
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -4001,6 +4037,18 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
40014037

40024038
===========================================================================
40034039

4040+
Mapbox Navigation uses portions of the Android WorkManager Kotlin Extensions.
4041+
URL: [https://developer.android.com/jetpack/androidx/releases/work#2.7.1](https://developer.android.com/jetpack/androidx/releases/work#2.7.1)
4042+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
4043+
4044+
===========================================================================
4045+
4046+
Mapbox Navigation uses portions of the Android WorkManager Runtime (Android WorkManager runtime library).
4047+
URL: [https://developer.android.com/jetpack/androidx/releases/work#2.7.1](https://developer.android.com/jetpack/androidx/releases/work#2.7.1)
4048+
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
4049+
4050+
===========================================================================
4051+
40044052
Mapbox Navigation uses portions of the AndroidSVG (SVG rendering library for Android.).
40054053
URL: [https://github.com/BigBadaboom/androidsvg](https://github.com/BigBadaboom/androidsvg)
40064054
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -4259,6 +4307,12 @@ License: [Mapbox Terms of Service](https://www.mapbox.com/legal/tos/)
42594307

42604308
===========================================================================
42614309

4310+
Mapbox Navigation uses portions of the Mapbox Navigation Copilot (Artifact that provides Copilot capabilities).
4311+
URL: [https://github.com/mapbox/mapbox-navigation-android](https://github.com/mapbox/mapbox-navigation-android)
4312+
License: [Mapbox Terms of Service](https://www.mapbox.com/legal/tos/)
4313+
4314+
===========================================================================
4315+
42624316
Mapbox Navigation uses portions of the Mapbox Navigation Metrics (Artifact that provides the default implementation of the metrics integration).
42634317
URL: [https://github.com/mapbox/mapbox-navigation-android](https://github.com/mapbox/mapbox-navigation-android)
42644318
License: [Mapbox Terms of Service](https://www.mapbox.com/legal/tos/)

android-auto-app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
src/main/res/values/mapbox_access_token.xml

android-auto-app/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Mapbox Navigation Android-Auto SDK Examples
2+
3+
The android-auto-app is for developing the Android Auto library.
4+
5+
Refer to the examples repository for the released solutions https://github.com/mapbox/mapbox-navigation-android-examples.
6+
7+
## Installation
8+
9+
1. Change "Configuration" of "android-auto-app". "Launch Options - Launch" should be "Nothing"
10+
1. Update or create the "mapbox_access_token.xml" under "android-auto-app/src/main/res/values" and put below
11+
<?xml version="1.0" encoding="utf-8"?>
12+
<resources xmlns:tools="http://schemas.android.com/tools">
13+
<string name="mapbox_access_token" translatable="false" tools:ignore="UnusedResources">PUBLIC TOKEN HERE</string>
14+
</resources>
15+
1. Establish Android Auto environment by following [Google's document](https://developer.android.com/training/cars/testing) or [Readme](https://github.com/mapbox/mapbox-navigation-android-examples/blob/main/android-auto/README.md)
16+
1. Run "android-auto-app" which installs the app on your device
17+
1. Run the app on "Desktop Head Unit"
18+
19+
## Enable route replay (AUTO_DRIVE)
20+
21+
When testing Android Auto, it is easy to simulate a route instead of using mock locations. Follow these instructions, to enable route replay.
22+
https://docs.mapbox.com/android/navigation/guides/developer-tools/route-replay/
23+
24+
```
25+
1. Start the desktop head unit
26+
2. Open your navigation app
27+
3. $ adb shell dumpsys activity service com.mapbox.navigation.examples.androidauto.car.MainCarAppService AUTO_DRIVE
28+
```

android-auto-app/build.gradle

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'com.mapbox.maps.token'
4+
apply from: "${rootDir}/gradle/script-git-version.gradle"
5+
apply from: "${rootDir}/gradle/ktlint.gradle"
6+
7+
android {
8+
compileSdkVersion androidVersions.compileSdkVersion
9+
10+
def getGitHash = { ->
11+
try {
12+
def stdout = new ByteArrayOutputStream()
13+
exec {
14+
commandLine 'git', 'rev-parse', '--short', 'HEAD'
15+
standardOutput = stdout
16+
}
17+
return stdout.toString().trim()
18+
} catch (Exception exception) {
19+
return ""
20+
}
21+
}
22+
23+
kotlinOptions {
24+
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
25+
}
26+
27+
defaultConfig {
28+
applicationId "com.mapbox.navigation.examples.androidauto"
29+
minSdkVersion androidVersions.carMinSdkVersion
30+
targetSdkVersion androidVersions.targetSdkVersion
31+
versionCode gitVersionCode
32+
versionName gitVersionName
33+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
34+
testInstrumentationRunnerArguments clearPackageData: 'true'
35+
vectorDrawables.useSupportLibrary = true
36+
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
37+
}
38+
39+
testOptions {
40+
execution 'ANDROIDX_TEST_ORCHESTRATOR'
41+
}
42+
43+
buildTypes {
44+
debug {
45+
testCoverageEnabled = false
46+
manifestPlaceholders = [enableCrashReporting: "false"]
47+
}
48+
}
49+
50+
lintOptions {
51+
abortOnError false
52+
}
53+
54+
buildFeatures {
55+
viewBinding true
56+
}
57+
58+
compileOptions {
59+
sourceCompatibility JavaVersion.VERSION_1_8
60+
targetCompatibility JavaVersion.VERSION_1_8
61+
}
62+
63+
kotlinOptions {
64+
jvmTarget = "1.8"
65+
}
66+
}
67+
68+
dependencies {
69+
// Mapbox Navigation Android Auto SDK
70+
implementation project(':libnavui-androidauto')
71+
72+
// This library will depend on the latest stable version.
73+
implementation("com.mapbox.navigation:ui-dropin:2.9.1")
74+
75+
// Dependencies needed for this example.
76+
implementation dependenciesList.androidXAppCompat
77+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.mapbox.navigation.examples.androidauto">
4+
5+
<application
6+
android:name=".ExampleApplication"
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/Theme.MapboxNavigationExamples">
13+
<activity
14+
android:name=".app.MainActivity"
15+
android:exported="true">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
23+
<service
24+
android:name=".car.MainCarAppService"
25+
android:exported="true"
26+
android:label="@string/app_name"
27+
android:icon="@mipmap/ic_launcher"
28+
android:foregroundServiceType="location">
29+
30+
<intent-filter>
31+
<action android:name="androidx.car.app.CarAppService" />
32+
<category android:name="androidx.car.app.category.NAVIGATION" />
33+
</intent-filter>
34+
35+
</service>
36+
</application>
37+
38+
</manifest>

0 commit comments

Comments
 (0)