[Solved] 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

[Solved] automatically sms read not working in android

For Xiaomi Permission Dialog Use this Read all SMS private void displaySmsLog() { Uri allMessages = Uri.parse(“content://sms/”); //Cursor cursor = managedQuery(allMessages, null, null, null, null); Both are same Cursor cursor = getActivity().getContentResolver().query(allMessages, null, null, null, null); if (cursor!=null) { while (cursor.moveToNext()) { for (int i = 0; i < cursor.getColumnCount(); i++) { Log.d(cursor.getColumnName(i) + “”, … Read more