Android sms manager not sending sms

To complete @Android Fanatic answer If the text is too long, the message does not go away, you have to respect max length depending of encoding. More information can be found here. I’d prefer this method SmsManager sms = SmsManager.getDefault(); ArrayList<String> parts = sms.divideMessage(message); ArrayList<PendingIntent> sendList = new ArrayList<>(); sendList.add(sentPI); ArrayList<PendingIntent> deliverList = new ArrayList<>(); … Read more

Option to send sms using Sim1 or Sim2 programmatically

You can use this code for API level 22+ (Android 5.0) LOLLIPOP_MR1. private void sendDirectSMS() { private static String SENT = “SMS_SENT”, DELIVERED = “SMS_DELIVERED”; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent( SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); // SEND BroadcastReceiver BroadcastReceiver sendSMS = new BroadcastReceiver() { @Override public void onReceive(Context … Read more

Send SMS until it is successful

Here is what I have done: public class SMSSender extends IntentService { public static final String INTENT_MESSAGE_SENT = “message.sent”; public static final String INTENT_MESSAGE_DELIVERED = “message.delivered”; public static final String EXTRA_MESSAGE = “extra.message”; public static final String EXTRA_RECEIVERS = “extra.receivers”; public SMSSender() { super(“SMSSender”); } private final String TAG = “SendSMS”; private static class IDGenerator … Read more

How to send a SMS using SMSmanager in Dual SIM mobile?

I use this way to manage which sim to use for sending SMS even long message .. Its working on my dual sim phone Lenovo A319 (4.4.3), no need for root. its built on reflection. import android.app.PendingIntent; import android.content.Context; import android.os.Build; import android.os.IBinder; import android.util.Log; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; /** * … Read more

Android send sms in Dual SIM Phone

Try the following method where simIndex is 0 for sim1 and 1 for sim2: public void sendSMS(final String number,final String text) { final PendingIntent localPendingIntent1 = PendingIntent.getBroadcast(mContext, 0, new Intent(this.SENT), 0); final PendingIntent localPendingIntent2 = PendingIntent.getBroadcast(mContext, 0, new Intent(this.DELIVERED), 0); if (Build.VERSION.SDK_INT >= 22) { SubscriptionManager subscriptionManager=((Activity)mContext).getSystemService(SubscriptionManager.class); SubscriptionInfo subscriptionInfo=subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(simIndex); SmsManager.getSmsManagerForSubscriptionId(subscriptionInfo.getSubscriptionId()).sendTextMessage(number, null, text, localPendingIntent1, localPendingIntent2); } … Read more