You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**Minimum mobile OS supported**| SDK 23+ | iOS 15.0+ |
12
12
13
13
* A React Native project
14
14
* 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)
Copy file name to clipboardExpand all lines: example/LMFS/README.md
+32-10Lines changed: 32 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,27 +6,49 @@ This is a sample application that show cases developers how to integrate with th
6
6
7
7
## Prerequisites
8
8
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.
11
12
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
14
14
15
-
##How to run application
15
+
### Android
16
16
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:
18
19
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
20
22
21
-
1. Come back to the current directory.
23
+
### iOS
22
24
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.
24
38
25
39
## Debugging Fleet engine logs
26
40
41
+
### Fetch fleet engine logs via the console
42
+
27
43
To make sure that location updates are propagating properly, you can use Fleet Engine logs.
28
44
29
45
1. Go to https://console.cloud.google.com/ and select the relevant project.
30
46
1. Open the "Logs Explorer".
31
47
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.
0 commit comments