smart_location 3.8.0
smart_location: ^3.8.0 copied to clipboard
Smart Location is a powerful, battery-conscious Flutter plugin for continuous background geolocation tracking, advanced geofencing, and motion-aware updates.
π― Smart Location
The most advanced, battery-efficient background location & telematics engine for Flutter.
smart_location is a highly modular, enterprise-grade mobility suite. Whether you just need simple background tracking or you want to build a full telematics & fleet management app, this package has you covered.
Why choose Smart Location?
- π Battery First: Automatically throttles GPS when the phone overheats or battery drops below 15%.
- π‘ App Store Safe: Built-in Google Play Prominent Disclosure UI guarantees you won't get rejected.
- π§ AI Telematics: Detects harsh braking and sharp cornering natively using IMU sensors.
- β‘ Real-Time: WebSockets and Delta-Encoding save 70% of network bandwidth.
π Quick Start (In 2 Minutes) #
You don't need to be an expert to get started. Just want background location? Here you go:
1. Request Permissions safely #
Avoid App Store & Play Store rejections by using our built-in Prominent Disclosure:
import 'package:smart_location/smart_location.dart';
await smartPermission.requestBackgroundWithProminentDisclosure(
context: context,
appName: 'My App',
justification: 'calculate route distance automatically',
);
2. Start Tracking (Even when killed!) #
await NativeEngine.startTracking(
accuracy: LocationAccuracy.high,
distanceFilter: 10, // meters
);
That's it! Your app is now tracking in the background natively.
π Advanced Features (Modular & Opt-In) #
smart_location is completely modular. If you don't use these features, they won't run, keeping your app incredibly lightweight.
π― Velocity-Aware Geofencing #
Traditional geofences are static. Our geofences dynamically expand based on how fast the user is driving, ensuring your app wakes up before they blow past the destination!
await NativeGeofenceManager.addGeofence(
id: 'warehouse_1',
latitude: 37.7749,
longitude: -122.4194,
radiusInMeters: 200, // Base radius
);
π ML-Powered Driving Telematics #
Detect harsh braking, rapid acceleration, and speeding natively using device IMU sensors (accelerometer & gyroscope). Perfect for insurance and ride-sharing apps.
final telematics = DrivingTelematicsEngine();
telematics.onDrivingEvent.listen((event) {
print('Detected: ${event.type} (Severity: ${event.severity})');
});
π‘ Real-Time WebSocket Telemetry #
Stop spamming REST APIs. Pipe your live locations directly to a WebSocket. We use Delta Encoding to only send the difference between coordinates, saving 70% of your data bills.
SyncEngine.enableLiveTelemetry('wss://your-fleet-server.com/socket');
π± Running the Example App #
Our example app is a fully-fledged Sandbox featuring a G-Force meter, custom Map styling, and Background configurations!
cd example
flutter run
π‘ App Store & Play Store Compliance #
Background location is heavily scrutinized by Apple and Google. We wrote a dedicated guide to ensure your app gets approved on the first try. π Read the Store Compliance Guide here