You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flutter info (flutter info, flutter doctor):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Versión 10.0.18363.592], locale es-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Proxy Configuration
[√] Connected device (1 available)
• No issues found!
To Reproduce
Steps to reproduce the behavior:
In foreground app send the SMS
In background app send the SMS
After close app, Exception received
backgroundFetchHeadlessTask(String taskId) async {
if (taskId == kNotificationTask) {
await Sendsms.onGetPermission();
if (await Sendsms.hasPermission())
await Sendsms.onSendSMS(number, message);
};
BackgroundFetch.finish(taskId);
}
Unhandled Exception: PlatformException(error, Attempt to invoke v
irtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference, null)
FYI plugins can’t request permissions when app is terminated and headless. There’s no user available to respond to permission requests.
Seek support with whatever plugin you’re using that’s causing this crash.
Your Environment
flutter info
,flutter doctor
):[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Versión 10.0.18363.592], locale es-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Proxy Configuration
[√] Connected device (1 available)
• No issues found!
To Reproduce
Steps to reproduce the behavior:
backgroundFetchHeadlessTask(String taskId) async {
if (taskId == kNotificationTask) {
await Sendsms.onGetPermission();
if (await Sendsms.hasPermission())
await Sendsms.onSendSMS(number, message);
};
BackgroundFetch.finish(taskId);
}
Debug logs
$ adb logcat
05-25 13:40:44.100 32645 32711 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke v
irtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference, null)
05-25 13:40:44.100 32645 32711 E flutter : #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
05-25 13:40:44.100 32645 32711 E flutter : [Initial Version] #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
05-25 13:40:44.100 32645 32711 E flutter :
05-25 13:40:44.100 32645 32711 E flutter : Initial version #2 Sendsms.onGetPermission (package:sendsms/sendsms.dart:23:27)
05-25 13:40:44.100 32645 32711 E flutter : Import naming error @ Android setup for headless implementation #3 SMS.sendEmergencySMS (package:careme/services/sms.dart:27:21)
05-25 13:40:44.100 32645 32711 E flutter :
05-25 13:40:44.100 32645 32711 E flutter : Background fetch event not received after the first time #4 _initScheduleNotification (package:careme/main.dart:89:21)
05-25 13:40:44.100 32645 32711 E flutter :
05-25 13:40:44.100 32645 32711 E flutter : Can we have multiple background fetch services? #5 backgroundFetchHeadlessTask (package:careme/main.dart:190:42)
05-25 13:40:44.100 32645 32711 E flutter :
05-25 13:40:44.100 32645 32711 E flutter : Cannot run released app. #6 _headlessCallbackDispatcher. (package:background_fetch/background_fetch.dart:619:15
)
05-25 13:40:44.100 32645 32711 E flutter : How to use HTTP requests on "backgroundFetchHeadlessTask" method #7 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:402:55)
05-25 13:40:44.100 32645 32711 E flutter : Is it possible to use WorkManager? #8 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.
dart:370:54)
05-25 13:40:44.100 32645 32711 E flutter : Access non static functions of MyApp in backgroundFetchHeadlessTask #9 _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:200:33)
05-25 13:40:44.100 32645 32711 E flutter :
05-25 13:40:44.100 32645 32711 E flutter : ttempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference #10 _invoke3. (dart:ui/hooks.dart:303:15)
05-25 13:40:44.100 32645 32711 E flutter : Headless Task keeps stopping Application #11 _rootRun (dart:async/zone.dart:1126:13)
05-25 13:40:44.100 32645 32711 E flutter : Headless Background Task can not be executed #12 _CustomZone.run (dart:async/zone.dart:1023:19)
05-25 13:40:44.100 32645 32711 E flutter : java.lang.IllegalArgumentException: No such service ComponentInfo{com.trackees.tracks/com.transistorsoft.tsbackgroundfetch.FetchJobService} #13 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
05-25 13:40:44.100 32645 32711 E flutter : error while executing job #14 _invoke3 (dart:ui/hooks.dart:302:10)
05-25 13:40:44.100 32645 32711 E flutter : migration to androidx #15 _dispatchPlatformMessage (dart:ui/hooks.dart:162:5)
The text was updated successfully, but these errors were encountered: