'Unable to send SMS using telephony

I have been trying to send SMS using telephony by following the youtube tutorial https://www.youtube.com/watch?v=X4yFdl3o1Lg. However, no message is being sent despite adding the required permissions.

  final SmsSendStatusListener listener = (SendStatus status) {
// Handle the status

 };

  final Telephony telephony = Telephony.instance;
  

  final _formKey = GlobalKey<FormState>();

    _sendSMS2() async {
       
        bool? permissionsGranted = await telephony.requestSmsPermissions;
        print(permissionsGranted);  //returns true
        bool? canSendSms = await telephony.isSmsCapable;
        print(canSendSms); //returns true
        // Get sim state
        SimState simState = await telephony.simState;
        print(simState);  //returns SimState.READY
        
        telephony.sendSms(to: "123456", message: "hello", statusListener: listener);
        
        }
      }

The status returns sendStatus.SENT but I don't find any message being sent. I really need help, please.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source