Closed J-DreaMy closed 4 years ago
Have you upgraded your flutter app to 1.12?
The latest version of flutter_background_geolocation
is 1.7.0
Yes, 3rd-party plugins can certainly be referenced in the headless task. I do.
In my case i update package barcode_scan version from 1.0.0 to 2.0.1
Your Environment
flutter doctor
):void main() async { runApp(MyApp()); bg.BackgroundGeolocation.registerHeadlessTask(headlessTask); }
static void onTriggerQuickAction(bg.GeofenceEvent event) async { String message = "Quick Action \"${event.extras['name']}\" Has Been Trigger Succesfully"; print('Debug.Geolocation : $message'); final api = Api(); api.executeQuickAction(event.identifier); // FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); // error here // String fcmToken = await _firebaseMessaging.getToken(); SharedPreferences prefs = await SharedPreferences.getInstance(); // error here String fcmToken = prefs.getString("fcmToken"); NotificationService.sendMessageTo(title: "Bliving", body: message, fcmToken: fcmToken); }