Skip to content

Commit f6b5e67

Browse files
committed
feat: upgrade Android Driver SDK to version 7.0.0
1 parent 6f66729 commit f6b5e67

File tree

8 files changed

+34
-19
lines changed

8 files changed

+34
-19
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ This is the beta release of the Google Driver SDK package for React Native. It i
1515

1616
| | Android | iOS |
1717
| ------------------------------- | ------- | --------- |
18-
| **Minimum mobile OS supported** | SDK 24+ | iOS 16.0+ |
18+
| **Minimum mobile OS supported** | SDK 26+ | iOS 16.0+ |
19+
| **Compile/Target SDK** | SDK 36+ | - |
1920

2021
* A React Native project
2122
* A Google Cloud project
@@ -100,16 +101,18 @@ dependencies {
100101

101102
#### Minimum SDK Requirements for Android
102103

103-
The `minSdkVersion` for your Android project must be set to 24 or higher in `android/app/build.gradle`:
104+
The `minSdkVersion` for your Android project must be set to 26 or higher in `android/app/build.gradle`:
104105

105106
```groovy
106107
android {
107108
defaultConfig {
108-
minSdkVersion 24
109+
minSdkVersion 26
109110
}
110111
}
111112
```
112113

114+
The `compileSdkVersion` and `targetSdkVersion` should be set to 36 or higher.
115+
113116
#### Set Google Maps API Key
114117

115118
To securely store your API key, it is recommended to use the [Google Maps Secrets Gradle Plugin](https://developers.google.com/maps/documentation/android-sdk/secrets-gradle-plugin). This plugin helps manage API keys without exposing them in your app's source code.

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ if (isNewArchitectureEnabled()) {
4040
android {
4141
namespace "com.google.android.react.driversdk"
4242

43-
compileSdkVersion 35
43+
compileSdkVersion 36
4444

4545
compileOptions {
4646
sourceCompatibility JavaVersion.VERSION_1_8
4747
targetCompatibility JavaVersion.VERSION_1_8
4848
}
4949

5050
defaultConfig {
51-
minSdkVersion 23
52-
targetSdkVersion 34
51+
minSdkVersion 26
52+
targetSdkVersion 36
5353
versionCode 1
5454
// get version name from package.json version
5555
versionName "1.0"
@@ -85,7 +85,7 @@ repositories {
8585
}
8686

8787
dependencies {
88-
implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:6.2.0'
88+
implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:7.0.0'
8989
implementation 'com.facebook.react:react-native:+'
9090
implementation 'com.android.support:multidex:1.0.3'
9191
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

android/src/main/java/com/google/android/react/driversdk/lmfs/DeliveryDriverModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void setLocationReportingInterval(int interval, Promise promise) {
137137
return;
138138
}
139139

140-
vehicleReporter.setLocationReportingInterval(new Long(interval), TimeUnit.SECONDS);
140+
vehicleReporter.setLocationReportingInterval(Long.valueOf(interval), TimeUnit.SECONDS);
141141
} catch (Exception e) {
142142
promise.reject(e.toString(), e.getMessage(), e);
143143
}

android/src/main/java/com/google/android/react/driversdk/odrd/RidesharingModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void setLocationReportingInterval(int interval, Promise promise) {
161161
return;
162162
}
163163

164-
vehicleReporter.setLocationReportingInterval(new Long(interval), TimeUnit.SECONDS);
164+
vehicleReporter.setLocationReportingInterval(Long.valueOf(interval), TimeUnit.SECONDS);
165165
} catch (Exception e) {
166166
promise.reject(e.toString(), e.getMessage(), e);
167167
}

example/LMFS/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def enableDesugaring = true
2020
buildscript {
2121
ext {
2222
buildToolsVersion = "36.0.0"
23-
minSdkVersion = 34
23+
minSdkVersion = 26
2424
compileSdkVersion = 36
2525
targetSdkVersion = 36
2626
ndkVersion = "27.1.12297006"

example/LMFS/src/App.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ const BASE_URL =
6262
// See README.md for configuration options.
6363
const VEHICLE_ID_DEFAULT = LMFS_VEHICLE_ID || ''; // ADD_VEHICLE_ID_HERE
6464

65+
// New location reporting interval in seconds that is applied via menu action.
66+
const NEW_LOCATION_REPORTING_INTERVAL_SECONDS = 20;
67+
6568
const termsAndConditionsDialogOptions: TermsAndConditionsDialogOptions = {
6669
title: 'RN LMFS Sample',
6770
companyName: 'Sample Company',
@@ -259,11 +262,14 @@ function LMFSSampleApp() {
259262
}
260263
};
261264

262-
const setUpdateInterval = async () => {
265+
const setLocationReportingInterval = async () => {
263266
try {
264267
await deliveryDriverApi
265268
.getDeliveryVehicleReporter()
266-
.setLocationReportingInterval(20);
269+
.setLocationReportingInterval(NEW_LOCATION_REPORTING_INTERVAL_SECONDS);
270+
console.log(
271+
`Location reporting interval set to ${NEW_LOCATION_REPORTING_INTERVAL_SECONDS} seconds`
272+
);
267273
} catch (e) {
268274
console.error(e);
269275
}
@@ -459,8 +465,8 @@ function LMFSSampleApp() {
459465
</View>
460466
<View style={styles.buttonWrapper}>
461467
<ActionButton
462-
title="Update time interval"
463-
onPress={setUpdateInterval}
468+
title={`Set Location Reporting Interval to ${NEW_LOCATION_REPORTING_INTERVAL_SECONDS}s`}
469+
onPress={setLocationReportingInterval}
464470
backgroundColor={buttonBackgroundColor}
465471
pressedBackgroundColor={buttonBackgroundColorPressed}
466472
/>

example/ODRD/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def enableDesugaring = true
2020
buildscript {
2121
ext {
2222
buildToolsVersion = "36.0.0"
23-
minSdkVersion = 34
23+
minSdkVersion = 26
2424
compileSdkVersion = 36
2525
targetSdkVersion = 36
2626
ndkVersion = "27.1.12297006"

example/ODRD/src/App.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const BASE_URL =
6464
// See README.md for configuration options.
6565
const VEHICLE_ID_DEFAULT = ODRD_VEHICLE_ID || ''; // ADD_VEHICLE_ID_HERE
6666

67+
// New location reporting interval in seconds that is applied via menu action.
68+
const NEW_LOCATION_REPORTING_INTERVAL_SECONDS = 20;
69+
6770
const termsAndConditionsDialogOptions: TermsAndConditionsDialogOptions = {
6871
title: 'RN ODRD Sample',
6972
companyName: 'Sample Company',
@@ -251,11 +254,14 @@ function ODRDSampleApp() {
251254
}
252255
};
253256

254-
const setUpdateInterval = async () => {
257+
const setLocationReportingInterval = async () => {
255258
try {
256259
await ridesharingDriverApi
257260
.getRidesharingVehicleReporter()
258-
.setLocationReportingInterval(20);
261+
.setLocationReportingInterval(NEW_LOCATION_REPORTING_INTERVAL_SECONDS);
262+
console.log(
263+
`Location reporting interval set to ${NEW_LOCATION_REPORTING_INTERVAL_SECONDS} seconds`
264+
);
259265
} catch (e) {
260266
console.error(e);
261267
}
@@ -460,8 +466,8 @@ function ODRDSampleApp() {
460466
</View>
461467
<View style={styles.buttonWrapper}>
462468
<ActionButton
463-
title="Update time interval"
464-
onPress={setUpdateInterval}
469+
title={`Set Location Reporting Interval to ${NEW_LOCATION_REPORTING_INTERVAL_SECONDS}s`}
470+
onPress={setLocationReportingInterval}
465471
backgroundColor={buttonBackgroundColor}
466472
pressedBackgroundColor={buttonBackgroundColorPressed}
467473
/>

0 commit comments

Comments
 (0)