'Samsung Devices API 12 does not Dial code automatically

We are trying to dial the code

  "*%2306%23" = "*#06#" 

through the adb command to fetch the information about the IMEI

 adb -s "DEVICE SERIAL" shell am start -a android.intent.action.DIAL -d tel:*%2306%23

The connected device shows the code on the screen but doesn't auto-dial. But, when we try to dial manually it's working fine.

The device is connected and the developer option is enabled.

Any help would be appreciated.



Solution 1:[1]

The intent that you are sending only opens the dialer app and enters the number, it does not dial. In order to dial you have to press the call button - adb shell input keyevent KEYCODE_CALL, but...
you are not dialing a regular number, you want to enter some code, so you have to open the dialer and enter the code symbol by symbol:

adb shell am start -a android.intent.action.DIAL
adb shell input keyevent KEYCODE_STAR
adb shell input keyevent KEYCODE_POUND
adb shell input keyevent KEYCODE_0
adb shell input keyevent KEYCODE_6
adb shell input keyevent KEYCODE_POUND

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TDG