Issue
I set up everything without skipping a single point from this plugin. It's working in all debug modes (Foreground, Background, Kill stat).
ERROR LOG: While killing the app in release mode
E/FlutterGeolocator(24131): Geolocator position updates stopped
D/FlutterGeolocator(24131): Stopping location service.
D/FlutterLocationService(24131): Unbinding from location service.
D/FlutterLocationService(24131): Destroying service.
E/flutter (24131): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:flutter_background_geolocation/flutter_background_geolocation.dart' not found.
E/flutter (24131): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter (24131): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
E/flutter (24131): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
E/flutter (24131): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.
Permission in Android Manifest
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
Solution
This seems to be an issue across Flutter 3.3 which is breaking plugins running in isolates.
You need to annotate top level or static functions running in isolates with @pragma('vm:entry-point')
Like this
@pragma('vm:entry-point')
void locationCallback() {
.......
});
}
Answered By - AndroidCoder
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.