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
246 stars 191 forks source link

Not using SmsManager for direct SMS transmission #57

Open s681562 opened 2 years ago

s681562 commented 2 years ago

This is not an issue, but please update your code for using direct SMS transmission (without popup or additional view). It is more user friendly without additional popup for pre-edit the sms content. Why user must see the edit page, if the app already prepared the content for the sms?

await sendSMS(...) should send SMS directly without delay or sms popup edit page.

In Android you can do:

// SmsManager is android.telephony String destinationAddress = "35235235;235423523"; String msg = "Text to send bla bla bla"; PendingIntent sentIntent = PendingIntent.getBroadcast(this, 0, new Intent("SMS_SENT_ACTION"), 0); SmsManager mSmsManager = SmsManager.getDefault(); String numbers[] = destinationAddress.split(";");

for(String num : numbers) { Logger.d(this, "msg.length() : " + msg.getBytes().length); if(msg.getBytes().length > 80) { ArrayList partMessage = mSmsManager.divideMessage(msg); mSmsManager.sendMultipartTextMessage(num, null, partMessage, null, null); }else { mSmsManager.sendTextMessage(num, null, msg, sentIntent, null); } }

Thank you in advance.