shounakmulay / Telephony

Flutter plugin for telephony features like query device sms directory, listen for incoming messages, retrieve various network parameters, etc.
https://telephony.shounakmulay.dev
MIT License
140 stars 131 forks source link

Error Sending message on Real Device #149

Open chirag-ji opened 2 years ago

chirag-ji commented 2 years ago

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>
AchizuePriscilla commented 2 years ago

Also having this issue

crpo10 commented 2 years ago

also Having this issue, any news about it?

mosi5505 commented 2 years ago

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

Alashiq commented 2 years ago

did you find any solution ?

Alashiq commented 2 years ago

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 ?

AchizuePriscilla commented 2 years ago

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

The fix in this PR solved it for me

usman-js commented 2 years ago

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

appu-sm commented 2 years ago

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

kudah99 commented 2 years ago

Facing this issue too...

suhardik commented 2 years ago

153

hope this help

suhardik commented 2 years ago

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

musfiqshanta commented 1 year ago

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.

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

suhardik commented 1 year ago

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.

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"

Smueez commented 1 year ago

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

virtualars commented 1 year ago

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

suhardik commented 1 year ago

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

virtualars commented 1 year ago

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 :(

Endrikarab commented 1 year ago

Hello! Is there someone who solved this problem?Thanks

virtualars commented 1 year ago

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

brianXcode commented 1 year ago

This problem still persist!

suhardik commented 1 year ago

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 :)

djabiridrissou commented 5 months ago

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