-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot send SMS while in background #72
Comments
Did you figure this out? Am having the same problem. |
Yes, It was a permission issue. Resolved. |
Am having the same problem. What permission should I add or what should I change in the permissions? |
E/MethodChannel#flutter_sms( 9619): Failed to handle method call |
Can you share what the permission issue was? Thanks. |
What's the permission to add ? |
This is my code:
print("Handling a background message: ${message.messageId}"); print('Message data: ${message.data}'); String mobile = message.data['mobile_numbers']; FCM.mobile = mobile.split(','); FCM.message = message.data['message']; await sendSMS(message: FCM.message, recipients: FCM.mobile, sendDirect: true);
and the error is:
E/MethodChannel#flutter_sms(12626): Failed to handle method call
E/MethodChannel#flutter_sms(12626): java.lang.NullPointerException
E/MethodChannel#flutter_sms(12626): at com.example.flutter_sms.FlutterSmsPlugin.canSendSMS(FlutterSmsPlugin.kt:95)
E/MethodChannel#flutter_sms(12626): at com.example.flutter_sms.FlutterSmsPlugin.onMethodCall(FlutterSmsPlugin.kt:76)
E/MethodChannel#flutter_sms(12626): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#flutter_sms(12626): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#flutter_sms(12626): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#flutter_sms(12626): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#flutter_sms(12626): at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#flutter_sms(12626): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#flutter_sms(12626): at android.os.Looper.loop(Looper.java:224)
E/MethodChannel#flutter_sms(12626): at android.app.ActivityThread.main(ActivityThread.java:7562)
E/MethodChannel#flutter_sms(12626): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_sms(12626): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/MethodChannel#flutter_sms(12626): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
I/flutter (12626): FlutterFire Messaging: An error occurred in your background messaging handler:
I/flutter (12626): PlatformException(error, null, null, java.lang.NullPointerException
I/flutter (12626): at com.example.flutter_sms.FlutterSmsPlugin.canSendSMS(FlutterSmsPlugin.kt:95)
I/flutter (12626): at com.example.flutter_sms.FlutterSmsPlugin.onMethodCall(FlutterSmsPlugin.kt:76)
I/flutter (12626): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter (12626): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
I/flutter (12626): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
I/flutter (12626): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
I/flutter (12626): at android.os.Handler.handleCallback(Handler.java:883)
I/flutter (12626): at android.os.Handler.dispatchMessage(Handler.java:100)
I/flutter (12626): at android.os.Looper.loop(Looper.java:224)
I/flutter (12626): at android.app.ActivityThread.main(ActivityThread.java:7562)
I/flutter (12626): at java.lang.reflect.Method.invoke(Native Method)
I/flutter (12626): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.j
The text was updated successfully, but these errors were encountered: