Show me the code! – By Davanum Srinivas

December 12, 2007

Android – Call/Dial from the adb shell command line

Filed under: Uncategorized — Davanum Srinivas @ 2:43 pm

Check if the “phone” service is up and running

C:\android\DialPhone>adb shell
# service check phone
service check phone
Service phone: found

Dial a specific contact in the contact list

# service call phone 1 s16 "davanum"
service call phone 1 s16 "davanum"
Result: Parcel(NULL)

1

Dial a specific phone #

# service call phone 2 s16 "+15084157509"
service call phone 2 s16 "+15084157509"
Result: Parcel(NULL)

1

Home work – try these and leave me a comment on what it affects in the emulator

# service call phone 8 i32 0
service call phone 8 i32 0
Result: Parcel(NULL)
# service call phone 8 i32 1
service call phone 8 i32 1
Result: Parcel(NULL)

Other options

# service
service
Usage: service [-h|-?]
       service check SERVICE
       service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
   i32: Write the integer INT into the send parcel.
   s16: Write the UTF-16 string STR into the send parcel.
About these ads

17 Comments »

  1. [...] thirdly, thanks to Davanum’s discover of the ’service’ command, we can start to craft some nice simple OpenBinder interactions and see exactly how they work [...]

    Pingback by www.macrobug.com» Blog Archive » Decoding a ’service’ call in Android — December 15, 2007 @ 11:44 am

  2. Can i know what is the usage of ‘2’ and ‘s16′ in

    # service call phone 2 s16 “+15084157509″

    Comment by Ashokkumar — March 5, 2009 @ 1:56 am

  3. Cool! It works with terminal emulator app on the actual phone!

    I have place a real call via the command line.

    “service list” command shows a long list of services available. Where do we find documentation on all services available?

    I was looking for it on android.com but its well hidden somewhere, any links?

    Comment by Roberto Abrahamsson — April 17, 2009 @ 8:59 pm

  4. Hi , can u tell me whether this service command can be used on the board also or only on emulator ?

    Comment by Amit — August 12, 2009 @ 11:33 pm

  5. I mean can it be used for testing purpose on the device (the target device)

    Comment by Amit — August 13, 2009 @ 1:14 am

  6. Hi Davanam,
    After initiating call using the cmd
    service call phone 2 s16 “phone_number”
    ie ATD “Phone_number
    Is there any way to find out the results of the below AT commands on Android phones
    at+csq? Signal Quality Report.
    at+cind? Indicator Control
    at+clcc ? List of Connected calls and find wether its an MO/MT call.

    Thanks,
    Vishwa

    Comment by Vishwa — August 21, 2009 @ 3:46 pm

  7. hi, can you please tell me the adb shell command syntax to play a song using audio service.
    Thanks for your help,
    Pavani

    Comment by pavani — September 16, 2009 @ 4:28 am

    • adb shell am start -n com.android.music/com.android.music.MediaPlaybackActivity

      Comment by xperion — July 21, 2011 @ 5:11 am

  8. You want to check out the enums for these IPC’s in the JavaDocs here: http://www.androidjavadoc.com/1.0_r1_src/constant-values.html

    com.android.internal.telephony.ITelephony.Stub
    static final int TRANSACTION_call 2
    static final int TRANSACTION_cancelMissedCallsNotification 10
    static final int TRANSACTION_dial 1
    static final int TRANSACTION_disableApnType 19
    static final int TRANSACTION_disableDataConnectivity 21
    static final int TRANSACTION_disableLocationUpdates 17
    static final int TRANSACTION_enableApnType 18
    static final int TRANSACTION_enableDataConnectivity 20
    static final int TRANSACTION_enableLocationUpdates 16
    static final int TRANSACTION_endCall 4
    static final int TRANSACTION_getCallState 24
    static final int TRANSACTION_getCellLocation 23
    static final int TRANSACTION_getDataActivity 25
    static final int TRANSACTION_getDataState 26
    static final int TRANSACTION_handlePinMmi 12
    static final int TRANSACTION_isDataConnectivityPossible 22
    static final int TRANSACTION_isIdle 7
    static final int TRANSACTION_isOffhook 5
    static final int TRANSACTION_isRadioOn 8
    static final int TRANSACTION_isRinging 6
    static final int TRANSACTION_isSimPinEnabled 9
    static final int TRANSACTION_setRadio 14
    static final int TRANSACTION_showCallScreen 3
    static final int TRANSACTION_supplyPin 11
    static final int TRANSACTION_toggleRadioOnOff 13
    static final int TRANSACTION_updateServiceLocation 15

    Comment by kk — December 13, 2009 @ 4:05 am

  9. Wors from ssh… pretty sweet.

    *-*-*

    # service call phone
    service: No service specified for call
    Usage: service [-h|-?]
    service list
    service check SERVICE
    service call SERVICE CODE [i32 INT | s16 STR] …
    Options:
    i32: Write the integer INT into the send parcel.
    s16: Write the UTF-16 string STR into the send parcel.
    # service call phone 2 s16 “+31611530555″

    Comment by yaha — February 17, 2010 @ 11:43 am

  10. HiDavanam

    could you please tell me how to use “static final int TRANSACTION_disableApnType 19″ from adb shell ?

    i mean for activating/Deactivating PDP from adb shell.
    thanks
    rocky

    Comment by Rocky — February 26, 2010 @ 4:49 am

  11. same way i want use the all the Service . can u provide me the information about the All the Things……………thanks In Advance………

    i want check the media.player and sensors

    Comment by Raja — November 10, 2011 @ 7:57 am

  12. i am not able to see wallpaper so is there any way to start wallpaper related service or activity by this knid of command?

    Comment by jigar — January 24, 2012 @ 3:12 am

  13. Hi Davanam,

    Can you please guide how to dial USSD code via adb shell?

    Comment by rajan — February 5, 2013 @ 4:12 am

  14. Hi Davanam !

    After :
    service call phone 2 s16 “+15084157509″

    I would like to turn ON the loudspeaker, what command is used ???

    Thanks In Advance !

    Comment by Lastmember — March 30, 2013 @ 7:17 am

  15. Hey, I want to use this to make the alarm go off, for a shell script. How do I do that? It just gives “Result: Parcel(00000000 ‘….’)”

    Comment by Sean Lijek — April 9, 2013 @ 11:03 pm

  16. is there any adb command to switch the bands(bands like WCDMA band, GSM band etc.)?

    Comment by roadie — March 24, 2014 @ 2:18 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 131 other followers

%d bloggers like this: