sawa-fleet-map
v0.2.0
Published
Sawa Telematics Fleet Map Clustering
Maintainers
Readme
npx# Sawa Fleet Map
A React Native module for fleet map clustering with Google Maps integration.
Features
- Native Google Maps integration
- Fleet vehicle clustering
- Custom map styling
- Config plugin for easy API key setup
Installation
npm install sawa-fleet-mapConfiguration
This module includes a config plugin that automatically configures Google Maps API keys for both Android and iOS platforms.
Using the Config Plugin
- Add the plugin to your
app.jsonorapp.config.js:
{
"expo": {
"plugins": [["sawa-fleet-map", { "apiKey": "YOUR_GOOGLE_MAPS_API_KEY" }]]
}
}Replace
YOUR_GOOGLE_MAPS_API_KEYwith your actual Google Maps API key.Run prebuild to apply the configuration:
npx expo prebuild --cleanWhat the Plugin Does
The config plugin automatically:
- Android: Adds the API key to
AndroidManifest.xmlas metadata with keycom.google.android.geo.API_KEY - iOS: Adds the API key to
Info.plistwith keyGMSApiKey
Manual Configuration (Alternative)
If you prefer to configure the API keys manually:
Android
Add to android/app/src/main/AndroidManifest.xml inside the <application> tag:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_GOOGLE_MAPS_API_KEY" />iOS
Add to ios/YourApp/Info.plist:
<key>GMSApiKey</key>
<string>YOUR_GOOGLE_MAPS_API_KEY</string>Usage
import { getApiKey } from "sawa-fleet-map";
// Get the configured Google Maps API key
const apiKey = getApiKey();
console.log("Google Maps API Key:", apiKey);Development
Building the Plugin
# Build the plugin TypeScript files
npm run build:plugin
# Or build once
npx tsc --project plugin/tsconfig.jsonTesting
# Run the example app
cd example
npx expo run:ios
# or
npx expo run:androidAPI Reference
getApiKey(): string
Returns the Google Maps API key configured for the current platform.
- Returns: The API key string configured via the config plugin or manual setup
- Platforms: iOS, Android
License
MIT
