From 707e93e0cd9d7b46df613dce17ecccd935e44b9b Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Wed, 31 Mar 2021 09:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8F=91=E5=88=B0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=9F=AD=E4=BF=A1=E6=94=AF=E6=8C=81=E9=95=BF?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/idormy/sms/forwarder/utils/SmsUtil.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java index 6092396a..2bd36a45 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/SmsUtil.java @@ -6,7 +6,7 @@ import android.content.Intent; import android.telephony.SmsManager; import android.util.Log; -import java.util.List; +import java.util.ArrayList; public class SmsUtil { static String TAG = "SmsUtil"; @@ -31,10 +31,15 @@ public class SmsUtil { PendingIntent sendPI = PendingIntent.getBroadcast(context, 0, new Intent(Context.TELEPHONY_SUBSCRIPTION_SERVICE), PendingIntent.FLAG_ONE_SHOT); PendingIntent deliverPI = PendingIntent.getBroadcast(context, 0, new Intent("DELIVERED_SMS_ACTION"), 0); - List divideContents = smsManager.divideMessage(message); - for (String text : divideContents) { - smsManager.sendTextMessage(mobiles, null, text, sendPI, deliverPI); + ArrayList sentPendingIntents = new ArrayList(); + ArrayList deliveredPendingIntents = new ArrayList(); + ArrayList divideContents = smsManager.divideMessage(message); + + for (int i = 0; i < divideContents.size(); i++) { + sentPendingIntents.add(i, sendPI); + deliveredPendingIntents.add(i, deliverPI); } + smsManager.sendMultipartTextMessage(mobiles, null, divideContents, sentPendingIntents, deliveredPendingIntents); return null; } catch (Exception e) {