shinewanna / BackgroundSmsPlugin

Apache License 2.0
12 stars 20 forks source link

Not working #2

Closed saswatsaubhagya closed 3 years ago

saswatsaubhagya commented 3 years ago

var result = await BackgroundSms.sendMessage( phoneNumber: "9xxxxxxxxx", message: "hello"); if (result == SmsStatus.sent) { print("Sent"); } else { print("Failed"); }

I added the permission in the android manifest still not working

W/System.err(10301): java.lang.SecurityException: Sending SMS message: uid 10909 does not have android.permission.SEND_SMS. W/System.err(10301): at android.os.Parcel.createException(Parcel.java:2071) W/System.err(10301): at android.os.Parcel.readException(Parcel.java:2039) W/System.err(10301): at android.os.Parcel.readException(Parcel.java:1987) W/System.err(10301): at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:1684) W/System.err(10301): at android.telephony.SmsManager$1.onSuccess(SmsManager.java:394) W/System.err(10301): at android.telephony.SmsManager.sendResolverResult(SmsManager.java:1408) W/System.err(10301): at android.telephony.SmsManager.resolveSubscriptionForOperation(SmsManager.java:1376) W/System.err(10301): at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:389) W/System.err(10301): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:362) W/System.err(10301): at com.j.background_sms.BackgroundSmsPlugin.sendSMS(BackgroundSmsPlugin.java:82) W/System.err(10301): at com.j.background_sms.BackgroundSmsPlugin.onMethodCall(BackgroundSmsPlugin.java:54) W/System.err(10301): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) W/System.err(10301): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) W/System.err(10301): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) W/System.err(10301): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(10301): at android.os.MessageQueue.next(MessageQueue.java:336) W/System.err(10301): at android.os.Looper.loop(Looper.java:197) W/System.err(10301): at android.app.ActivityThread.main(ActivityThread.java:7500) W/System.err(10301): at java.lang.reflect.Method.invoke(Native Method) W/System.err(10301): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) W/System.err(10301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) I/flutter (10301): PlatformException(Failed, Sms Not Sent, , null)

shinewanna commented 3 years ago

You have to allow the SEND_SMS permission. Use Permission Handler or something other. Screen Shot 2021-04-01 at 11 30 56 AM

It's already in docs.

If it's resolved, close the issue yourself for make sure.