Flutter SMS Detector

A flutter plugin for receiving incoming sms in android. Currently supports on only Android.

Usage

To use this plugin, add sms_detector as a dependency in your pubspec.yaml file.

Example

  @override
  void initState() {
    super.initState();
    retrieveNewSms();
  }

  retrieveNewSms()  {
    SmsDetector.waitForSms().then((x){
      // x is the body of SMS.
      setState(() {_smsBody = x;});
    }).catchError((e){
      print(e);
    });
  }


  @override
  void dispose() {
    //stop sms receiver
    SmsDetector.stopSmsReceiver();
    super.dispose();
  }

Libraries

sms_detector