#If JAVA
import android.app.PendingIntent;
import android.content.Intent;
import android.telephony.SmsManager;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
public static void SendSMS(String PhoneNumber,int sim, String Text, boolean ReceiveSentNotification, boolean ReceiveDeliveredNotification)
{
SmsManager sm = SmsManager.getSmsManagerForSubscriptionId(sim);
Intent i1 = new Intent("b4a.smssent");
i1.putExtra("phone", PhoneNumber);
PendingIntent pi = ReceiveSentNotification ? PendingIntent.getBroadcast(BA.applicationContext, 0, i1, 134217728) : null;
Intent i2 = new Intent("b4a.smsdelivered");
i2.putExtra("phone", PhoneNumber);
PendingIntent pi2 = ReceiveDeliveredNotification ? PendingIntent.getBroadcast(BA.applicationContext, 0, i2, 134217728) : null;
sm.sendTextMessage(PhoneNumber, null, Text, pi, pi2);
}
#End If