Get Started
The Flutter Map SDK reuses the MethodChannel("TrackingSdk") from the
Flutter Tracking SDK and adds one method,
openNativeMapScreen(), plus a native map screen on each platform.
Prerequisites and requirements
- The Flutter Tracking SDK
MethodChannelalready set up (the Map SDK does not open its own channel). - Completed native prerequisites for Android and iOS.
- A Map API key - see Contact us to request access.
1. Add the Dart method
In lib/tracking_sdk.dart (from the Tracking SDK setup), add:
static Future<bool> openNativeMapScreen() async {
final result = await _channel.invokeMethod<dynamic>('openNativeMapScreen');
if (result is bool) return result;
return result == true;
}
2. Native Android setup
Add the native Map SDK dependency and permissions from the
Android Map SDK page, create a MapSDK activity that
hosts SSMapView, register it in AndroidManifest.xml, then handle the case in MainActivity.kt:
"openNativeMapScreen" -> {
try {
startActivity(Intent(this, MapSDK::class.java))
result.success(true)
} catch (e: Exception) {
result.error("OPEN_MAP_ERROR", e.message, null)
}
}
3. Native iOS setup
Add the native Map SDK pod from the iOS Map SDK page,
create a SSMapNativeScreen view controller, then present it from SceneDelegate.swift:
case "openNativeMapScreen":
guard #available(iOS 15.0, *) else {
result(FlutterError(code: "IOS_VERSION_NOT_SUPPORTED",
message: "Native iOS map requires iOS 15.0 or newer.", details: nil))
return
}
let mapViewController = SSMapNativeScreen()
mapViewController.modalPresentationStyle = .fullScreen
topViewController.present(mapViewController, animated: true) {
result(true)
}
The Map SDK's iOS deployment target (15.0) is higher than the Tracking SDK's (13.0). If your app integrates both, set the app-wide deployment target to 15.0.
4. Trigger from Flutter
ElevatedButton(
onPressed: () async {
try {
await TrackingSdk.openNativeMapScreen();
} catch (e) {
debugPrint('Unable to open native map screen: $e');
}
},
child: const Text('Explore Map'),
)
Next steps
- Sample apps - reference source code on GitHub
Looking for background location collection instead? See the Flutter Tracking SDK.