Service call isms with ADB shell (Android SDK)?

2019-04-09 21:56发布

问题:

Do you know the command "service call isms" with adb shell on Android? Here is the complete command I use : service call isms 5 s16 "PhoneNumber" i32 0 i32 0 s16 "BodyText".

There are some parameter but I don't know what it means (5, s16, i32, 0). Is there somewhere a manual ? The most important for me is to get an error when the sms doesn't send successfully (about 10% of the sms aren't send) => this question asked already but there isn't answer (https://stackoverflow.com/questions/17395546/get-status-sms-from-isms-service-using-shell-adb-android-sdk).

I don't wanna use the commands (adb shell am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body "SMS BODY GOES HERE" --ez exit_on_sent true adb shell input keyevent 22 adb shell input keyevent 66) because it uses the graphical interface.

Could you help me? (I'm sorry, I can't speak English. So, I hope you understand my request)

Thanks a lot

回答1:

In every "service call" command, you need to enter:

  • the service you want to call, in this case it is "isms";
  • the "function" you want to call, in this case it is "5" (more about that later);
  • the function parameters.

There's two types of possible parameters: Strings and Integers. Before entering an Integer parameter you need to specify its type using i32. Same thing for a String parameter, but instead you need to write s16.

Most of the "service call" commands have no documentation, or very little.
For the ISms you can look here: http://www.androidjavadoc.com/1.0_r1_src/constant-values.html to get a list of the possible functions and their number code. Hit ctrl-f and enter ISms for quick access.

The "5" function for the ISms service is the sendMultipartText function from the ISms interface of the Android API. Here is the doc about this function. And here is the implementation class from the API.

So, service call isms 5 s16 "PhoneNumber" i32 0 i32 0 s16 "BodyText", equals:

Call the sendMultipartText function from the ISms service with the String parameter "PhoneNumber", the Integer parameter 0, the Integer parameter 0 and the String parameter "BodyText".

To answer your question, I am pretty sure there's no way to know if the sms are being sent or not from the command line... But maybe if you dig a little deeper than I did in the API you'll find a way.