You must make sure you follow
flutter_map's installation and additional setup instructions.
This module is only supported on Android.
Add the following to 'android\app\src\main\AndroidManifest.xml' and any other manifests:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="packageName">
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<application android:label="appName" android:icon="appIcon">
This will allow the application to acquire the necessary permissions (should the user allow them at runtime) to a background process.
FOREGROUND_SERVICE: allows the application to start a foreground service - a type of Android service that can run in the background, as long as the application isn't force stopped.
WAKE_LOCK: allows the background process (technically foreground service) to run even when the device is locked/asleep. Also allows the acquisition of a WiFi lock.
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS(must be requested at runtime): assists with the background process not being killed by the system.
Background downloading needs to show notifications, which requires a 3rd party package. See it's installation/setup instructions:
Please follow these additional instructions for supporting Android versions above 11 and building for release:
Unfortunately, I do not have the hardware to test this library on Apple platforms. If you find issues, please report them!
It is unknown whether this setup is needed in all cases, so it is recommended to follow these only when you receive errors during building your app.
Some developers may have issues when releasing the app or uploading to TestFlight - see issue #69 for the first report of this problem. This is due to some of this library's dependencies on platform plugins.
- Annotate that access is not needed to the Media, Audio, and Documents directories - this package uses only custom file types. Add these lines to your Podfile just before
target 'Runner' do.PodfilePod::PICKER_MEDIA = falsePod::PICKER_AUDIO = falsePod::PICKER_DOCUMENT = false
UIBackgroundModescapability with the
remote-notificationskeys to Xcode, to describe why your app needs to access background tasks - in this case to bulk download maps in the background.