Telephony icon indicating copy to clipboard operation
Telephony copied to clipboard

Error Sending message on Real Device

Open chirag-ji opened this issue 2 years ago • 22 comments

While sending an sms from a real device having android 11 with having permission: SEND_SMS,

call to function

await telephony.sendSms(
   to: mobileNum,
   message: message,
   statusListener: onSendStatus,
 );

throwing an exception

E/flutter (22839): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(failed_to_fetch_sms, Flutter Telephony: Error getting SmsManager, null, null)
E/flutter (22839): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (22839): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (22839): <asynchronous suspension>
E/flutter (22839): #2      Telephony.sendSms (package:telephony/telephony.dart:321:5)
E/flutter (22839): <asynchronous suspension>

chirag-ji avatar Jun 16 '22 09:06 chirag-ji

Also having this issue

AchizuePriscilla avatar Jun 17 '22 04:06 AchizuePriscilla

also Having this issue, any news about it?

crpo10 avatar Jun 17 '22 19:06 crpo10

me too... i cant send sms... Unhandled Exception: PlatformException(failed_to_fetch_sms, Flutter Telephony: Error getting SmsManager, null, null)

mosi5505 avatar Jun 18 '22 17:06 mosi5505

did you find any solution ?

Alashiq avatar Jul 14 '22 21:07 Alashiq

me too... i cant send sms... Unhandled Exception: PlatformException(failed_to_fetch_sms, Flutter Telephony: Error getting SmsManager, null, null)

did you find any solution ?

Alashiq avatar Jul 14 '22 22:07 Alashiq

https://github.com/shounakmulay/Telephony/pull/153

The fix in this PR solved it for me

AchizuePriscilla avatar Jul 14 '22 23:07 AchizuePriscilla

Facing this issue too. Can anyone have the solution for this?

usman-js avatar Jul 15 '22 21:07 usman-js

facing same issue, i'm wondered this issue is open for 1 year

appu-sm avatar Jul 20 '22 12:07 appu-sm

Facing this issue too...

kudah99 avatar Jul 25 '22 02:07 kudah99

#153

hope this help

suhardik avatar Aug 11 '22 14:08 suhardik

for everyone who facing this issue and still have no idea how to fix this... you can temporarily use package from my repository by changing telephony package inside pubspec.yaml

  telephony:
    git:
      url: https://github.com/suhardik/s_telephony.git
      ref: develop

package example

suhardik avatar Aug 12 '22 03:08 suhardik

e: /Users/shanta/FlutterSetUp/flutter/.pub-cache/git/s_telephony-78a83137120ce23b252454825272624ff37a8e1b/android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsController.kt: (27, 7): Redeclaration: SmsController e: /Users/shanta/FlutterSetUp/flutter/.pub-cache/hosted/pub.dartlang.org/telephony-0.2.0/android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsController.kt: (27, 7): Redeclaration: SmsController

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':telephony:compileDebugKotlin'.

Compilation error. See log for more details

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 14s Exception: Gradle task assembleDebug failed with exit code 1

musfiqshanta avatar Oct 09 '22 06:10 musfiqshanta

e: /Users/shanta/FlutterSetUp/flutter/.pub-cache/git/s_telephony-78a83137120ce23b252454825272624ff37a8e1b/android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsController.kt: (27, 7): Redeclaration: SmsController e: /Users/shanta/FlutterSetUp/flutter/.pub-cache/hosted/pub.dartlang.org/telephony-0.2.0/android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsController.kt: (27, 7): Redeclaration: SmsController

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':telephony:compileDebugKotlin'.

Compilation error. See log for more details

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 14s Exception: Gradle task assembleDebug failed with exit code 1

i think its different problem. you can try to run "flutter pub clean" and then run "flutter pub get", and finally, run "flutter run"

suhardik avatar Oct 09 '22 06:10 suhardik

i have changed pubspec.yaml as you said. but yet i am facing the same issue. i have ran flutter clean, flutter pub get but yet the problem has not been resolved

Smueez avatar Oct 18 '22 09:10 Smueez

also problem myself, it doesn't work on old devices

virtualars avatar Nov 03 '22 14:11 virtualars

also problem myself, it doesn't work on old devices

yes i guess. minSdkVersion of this library is 23. so it means that this library only works on device with OS Android 6.0 and later

suhardik avatar Nov 03 '22 14:11 suhardik

also problem myself, it doesn't work on old devices

yes i guess. minSdkVersion of this library is 23. so it means that this library only works on device with OS Android 6.0 and later

My sdk is 26 :(

virtualars avatar Nov 03 '22 14:11 virtualars

Hello! Is there someone who solved this problem?Thanks

Endrikarab avatar Dec 20 '22 09:12 Endrikarab

I changed plugin, I'm using this: https://pub.dev/packages/background_sms

virtualars avatar Dec 20 '22 09:12 virtualars

This problem still persist!

brianXcode avatar Aug 17 '23 10:08 brianXcode

almost 1 year but still not getting merged. for anyone who still get this error, you can try this solution: https://github.com/shounakmulay/Telephony/issues/149#issuecomment-1212695720

hope this help :)

suhardik avatar Aug 18 '23 06:08 suhardik

almost 1 year but still not getting merged. for anyone who still get this error, you can try this solution: #149 (comment)

hope this help :)

This help boss, thank you

djabiridrissou avatar May 03 '24 13:05 djabiridrissou