Skip to content

Instantly share code, notes, and snippets.

@lucianogiuseppe
Created March 29, 2022 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucianogiuseppe/758bb8471fe0119e7b55232343af9ecc to your computer and use it in GitHub Desktop.
Save lucianogiuseppe/758bb8471fe0119e7b55232343af9ecc to your computer and use it in GitHub Desktop.
Android 11 send SMS by ADB

Android 11

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment