Skip to content

Commit 2c554a4

Browse files
authored
feat: update driver and navigation sdk dependencies (#27)
* feat: update driver and navigation sdk dependencies * chore: fix LMFS backend by downgrading fleetengine package
1 parent 6aad66b commit 2c554a4

File tree

26 files changed

+291
-132
lines changed

26 files changed

+291
-132
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DerivedData
2929
*.xcuserstate
3030
project.xcworkspace
3131
.xcode.env.local
32+
Keys.plist
3233

3334
# Android/IJ
3435
#

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## [0.3.0](https://github.com/googlemaps/react-native-driver-sdk/compare/0.2.0-beta...0.3.0) (2024-11-04)
2+
3+
- feat: support latest navigation sdk library and Driver SDK's
4+
5+
## [0.2.0-beta](https://github.com/googlemaps/react-native-driver-sdk/compare/0.1.0-beta...0.2.0-beta) (2024-08-21)
6+
7+
- feat: support latest navigation sdk library
8+
9+
## [0.1.0-beta](https://github.com/googlemaps/react-native-driver-sdk/releases/tag/0.1.0-beta) (2024-05-17)
10+
11+
- Initial release

README.md

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

77
## Requirements
88

9-
| | Android | iOS |
10-
| ----------- | ------- | --------- |
11-
| **Support** | SDK 23+ | iOS 14.0+ |
9+
| | Android | iOS |
10+
| ------------------------------- | ------- | --------- |
11+
| **Minimum mobile OS supported** | SDK 23+ | iOS 15.0+ |
1212

1313
* A React Native project
1414
* A Google Cloud project with the [Navigation SDK enabled](https://developers.google.com/maps/documentation/navigation/android-sdk/set-up-project) and the [Maps SDK for iOS enabled](https://developers.google.com/maps/documentation/navigation/ios-sdk/config)

android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
import groovy.json.JsonSlurper
1616

1717
buildscript {
18+
ext.kotlin_version = '2.0.0'
1819
repositories {
1920
google()
2021
mavenCentral()
2122
}
2223

2324
dependencies {
24-
classpath("com.android.tools.build:gradle:7.2.1")
25+
classpath("com.android.tools.build:gradle:8.4.0")
26+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
2527
}
2628
}
2729

@@ -83,7 +85,7 @@ repositories {
8385
}
8486

8587
dependencies {
86-
implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:5.0.0'
88+
implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:5.99.0'
8789
implementation 'com.facebook.react:react-native:+'
8890
implementation 'com.android.support:multidex:1.0.3'
8991
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

example/LMFS/README.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,49 @@ This is a sample application that show cases developers how to integrate with th
66

77
## Prerequisites
88

9-
1. This library depends on the LMFS backend available in https://github.com/googlemaps/last-mile-fleet-solution-samples/tree/main/backend.
10-
This package provides docker-compose files to run the backend services at `/example/tools/backend` folder. For more information, please refer to the [README](../tools/backend/README.md) file in the tools/backend folder of the example app.
9+
1. This library depends on the LMFS backend available in https://github.com/googlemaps/last-mile-fleet-solution-samples/tree/main/backend. This package provides docker-compose files to run the backend services at `/example/tools/backend` folder. For more information, please refer to the [README](../tools/backend/README.md) file in the tools/backend folder of the example app.
10+
2. Once the backend is setup, create a delivery vehicle and keep the vehicleId handy. In order to make it easier to create vehicles with tasks, you can use the `/upload-delivery-config.html` endpoint on the backend. [example json](https://raw.githubusercontent.com/googlemaps/last-mile-fleet-solution-samples/main/backend/src/test/resources/test.json)
11+
3. Go to the [App.tsx](/example/LMFS/src/App.tsx) file and update the VEHICLE_ID from the endpoint response.
1112

12-
1. Once the backend is setup, create a delivery vehicle and keep the vehicleId handy. In order to make it easier to create vehicles with tasks, you can use the `/upload-delivery-config.html` endpoint on the backend. [example json](https://raw.githubusercontent.com/googlemaps/last-mile-fleet-solution-samples/main/backend/src/test/resources/test.json)
13-
2. Go to the [App.tsx](/example/LMFS/App.tsx) file and update the VEHICLE_ID from the endpoint response.
13+
## Setup
1414

15-
## How to run application
15+
### Android
1616

17-
1. Run `yarn install` from the current directory.
17+
1. Run `yarn install` in repository root directory.
18+
2. Open the `example/LMFS/android` folder in Android Studio and add your api key in local.properties by adding a line like this:
1819

19-
1. Go to the [ios](./ios) folder and run `pod install`.
20+
- `MAPS_API_KEY=YOUR_API_KEY` - make sure that this key is pointing to a Google Cloud project which had Nav SDK enabled.
21+
- To enable Nav SDK in your Android project follow this guide: https://developers.google.com/maps/documentation/navigation/android-sdk/set-up-project
2022

21-
1. Come back to the current directory.
23+
### iOS
2224

23-
1. Then you can use `yarn run react-native run-android` or `yarn run react-native run-ios` depending the platform.
25+
1. Run `yarn install` in repository root directory.
26+
2. To enable Nav SDK in your iOS project follow this guide: https://developers.google.com/maps/documentation/navigation/ios-sdk/config
27+
3. Go to the [ios](./ios) folder and run `pod install`.
28+
4. Copy the `Keys.plist.sample` file located in `example/LMFS/ios/SampleApp/` to a new file named `Keys.plist`. This file is git ignored and won't be accidentally committed. In your Google cloud console, add the Google API key to the project and add this newly created API key to the `Keys.plist` file.
29+
30+
```xml
31+
<key>API_KEY</key>
32+
<string>Your API KEY</string>
33+
```
34+
35+
## Running the app
36+
37+
Use `yarn run react-native run-android` or `yarn run react-native run-ios` depending the platform.
2438

2539
## Debugging Fleet engine logs
2640

41+
### Fetch fleet engine logs via the console
42+
2743
To make sure that location updates are propagating properly, you can use Fleet Engine logs.
2844

2945
1. Go to https://console.cloud.google.com/ and select the relevant project.
3046
1. Open the "Logs Explorer".
3147
1. Run Query `jsonPayload.request.deliveryVehicleId="vehicle_id"` and `jsonPayload.@type="type.googleapis.com/maps.fleetengine.v1.UpdateDeliveryVehicleLog"`.
32-
1. This will show the location updates sent through the library.
48+
1. This will show the location updates sent through the library.
49+
50+
### Use fleet tracking at the sample backend
51+
52+
1. Make sure the backend is running by following steps at [README](../tools/backend/README.md).
53+
2. Open Fleet Tracking at http://localhost:8091/fleet_tracking.html (or the port you have configured in your .env file).
54+
3. Enter the vehicleId and see the location updates on the map.

example/LMFS/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010
node_require('react-native/scripts/react_native_pods.rb')
1111
node_require('react-native-permissions/scripts/setup.rb')
1212

13-
platform :ios, "14.0"
13+
platform :ios, "15.0"
1414
prepare_react_native_project!
1515

1616
setup_permissions([

example/LMFS/ios/SampleApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
1313
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
1414
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
15+
52D1CA992CD4ED8D0020709E /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52D1CA982CD4ED8D0020709E /* Keys.plist */; };
1516
7699B88040F8A987B510C191 /* libPods-SampleApp-SampleAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-SampleApp-SampleAppTests.a */; };
1617
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1718
E72EC806AB287A94E8141AD5 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = E049A7A79160D0D74CDA8CD1 /* PrivacyInfo.xcprivacy */; };
@@ -40,6 +41,7 @@
4041
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = SampleApp/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4142
19F6CBCC0A4E27FBF8BF4A61 /* libPods-SampleApp-SampleAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SampleApp-SampleAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4243
3B4392A12AC88292D35C810B /* Pods-SampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleApp.debug.xcconfig"; path = "Target Support Files/Pods-SampleApp/Pods-SampleApp.debug.xcconfig"; sourceTree = "<group>"; };
44+
52D1CA982CD4ED8D0020709E /* Keys.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Keys.plist; sourceTree = "<group>"; };
4345
5709B34CF0A7D63546082F79 /* Pods-SampleApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleApp.release.xcconfig"; path = "Target Support Files/Pods-SampleApp/Pods-SampleApp.release.xcconfig"; sourceTree = "<group>"; };
4446
5B7EB9410499542E8C5724F5 /* Pods-SampleApp-SampleAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleApp-SampleAppTests.debug.xcconfig"; path = "Target Support Files/Pods-SampleApp-SampleAppTests/Pods-SampleApp-SampleAppTests.debug.xcconfig"; sourceTree = "<group>"; };
4547
5DCACB8F33CDC322A6C60F78 /* libPods-SampleApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SampleApp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -93,6 +95,7 @@
9395
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
9496
13B07FB51A68108700A75B9A /* Images.xcassets */,
9597
13B07FB61A68108700A75B9A /* Info.plist */,
98+
52D1CA982CD4ED8D0020709E /* Keys.plist */,
9699
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
97100
13B07FB71A68108700A75B9A /* main.m */,
98101
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
@@ -246,6 +249,7 @@
246249
isa = PBXResourcesBuildPhase;
247250
buildActionMask = 2147483647;
248251
files = (
252+
52D1CA992CD4ED8D0020709E /* Keys.plist in Resources */,
249253
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
250254
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
251255
E72EC806AB287A94E8141AD5 /* PrivacyInfo.xcprivacy in Resources */,

example/LMFS/ios/SampleApp/AppDelegate.mm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ - (BOOL)application:(UIApplication *)application
2626
// You can add your custom initial props in the dictionary below.
2727
// They will be passed down to the ViewController used by React Native.
2828
self.initialProps = @{};
29-
NSString *api_key =
30-
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"API_KEY"];
29+
30+
// Note: Ensure that you have copied the Keys.plist.sample to Keys.plist
31+
// and have added the correct API_KEY value to the file.
32+
//
33+
// Get the path for the Keys.plist file in the main bundle and read API_KEY.
34+
NSString *path = [[NSBundle mainBundle] pathForResource:@"Keys" ofType:@"plist"];
35+
NSDictionary *keysDictionary = [NSDictionary dictionaryWithContentsOfFile:path];
36+
NSString *api_key = [keysDictionary objectForKey:@"API_KEY"];
37+
3138
[GMSServices provideAPIKey:api_key];
32-
[GMSServices setMetalRendererEnabled:YES];
3339
return [super application:application
3440
didFinishLaunchingWithOptions:launchOptions];
3541
}

example/LMFS/ios/SampleApp/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>API_KEY</key>
6-
<string>[Add your key]</string>
75
<key>CFBundleDevelopmentRegion</key>
86
<string>en</string>
97
<key>CFBundleDisplayName</key>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>API_KEY</key>
6+
<string>[Add your key]</string>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)