Before run the adb command you must enable the Developer Options on your Android phone, then enable USB Debug (to use ADB) and disable Permission Monitoring
Run:
adb shell service call isms 5 i32 1 s16 "com.android.mms.service" s16 "null" s16 "+39phonenumber" s16 "null" s16 "hello\ world\ " s16 "null" s16 "null" i32 1 i32 0
The method is :
// link : https://github.com/aosp-mirror/platform_frameworks_base/blob/android11-release/telephony/java/com/android/internal/telephony/ISms.aidl
void sendTextForSubscriber(in int subId, String callingPkg, String callingAttributionTag,
in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent,
in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp,
in long messageId);
-
subId : SIM index ( 0 or 1 ) Not 1 and 2 !!
-
callingPkg : SMS Package name -> "com.android.mms.service"
-
destAddr : Receiver Number
-
scAddr : Number of SMS service center --> we don't care so we put "null" to set it to default value.
-
text : Message Body
-
sentIntent : we don't care so we put "null" to set it to default value.
-
deliveryIntent : we don't care so we put "null" to set it to default value.
For other Android versions see this tutorial and this adb tutorial