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
138 stars 126 forks source link

Sending an SMS on emulator/device having Android 12 causes platform exception. #132

Open srihari9n opened 2 years ago

srihari9n commented 2 years ago

In android emulator bundled with Android studio, you can send SMS of the number present in the controls, but trying to send an SMS to the same number using telephony causes exception.

I am able to send the sms from the sms app in the emulator though.

This is the error :

E/flutter (13683): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(illegal_argument, Incorrect method called on channel., null, null)
E/flutter (13683): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (13683): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (13683): <asynchronous suspension>
E/flutter (13683): #2      Telephony.sendSms (package:telephony/telephony.dart:321:5)
E/flutter (13683): <asynchronous suspension>
koukibadr commented 2 years ago

I got this error also when testing on an emulator Android 12 but it works on other emulators < Andorid 12 any updates ?

srihari9n commented 2 years ago

@koukibadr interesting ! I have not tried on a different emulator. Also, I also did not test this on a real device with Android 12.

Have you perhaps tried on a real Android 12 device? @koukibadr

koukibadr commented 2 years ago

I tested on a real device and it dosen't work also

srihari9n commented 2 years ago

@koukibadr thanks, I updated the issue title. Also maybe #129 could be a potential fix to this?

koukibadr commented 2 years ago

Maybe I think #129 fix the bug (I hope) but it's not merged yet