fluttercommunity / flutter_sms

A Flutter plugin to Send SMS and MMS on iOS and Android. If iMessage is enabled it will send as iMessage on iOS. This plugin must be tested on a real device on iOS. Maintainer: @rodydavis
https://fluttercommunity.github.io/flutter_sms/
MIT License
245 stars 182 forks source link

duplicate message #17

Closed sd-timaru closed 3 years ago

sd-timaru commented 4 years ago

Hi! In Android 8, the message that arrives at the sms application is duplicated (it appears twice the initially set message). On Android 9 and 10 is ok.

It may have something to do with putting twice the message in the intent.putExtra:


private fun sendSMS(result: Result, phones: String?, message: String?) {
    val intent = Intent(Intent.ACTION_SENDTO)
    intent.data = Uri.parse("smsto:$phones")
    intent.putExtra("sms_body", message)
    intent.putExtra(Intent.EXTRA_TEXT, message)
    activity?.startActivityForResult(intent, REQUEST_CODE_SEND_SMS)

  }
rodydavis commented 4 years ago

Please feel free to submit a PR, I haven't experienced this

Elykauf commented 4 years ago

Experienced the same thing. Maybe add a conditional checking for the version of android.

rodydavis commented 3 years ago

fixed on version 2.3.1 reopen if it is still an issue