'How to use AT commands in Android applications?

I want to send AT commands in my Android application, but I could not find the right syntax. How can I do this?



Solution 1:[1]

The invokeOemRilRequestRaw() and invokeOemRilRequestStrings() methods which have implementations in a number of classes (RIL, PhoneProxy, PhoneBase, and some others) are what you need, but they are not available through the SDK and thus off-limits to us mere mortals.

Solution 2:[2]

  1. There is a great review of this in the XDA forum thread:

    How to talk to the Modem with AT commands.

    That thread show you how to send AT commands (ATC) with a remote terminal (USB connected to you PC), but it has not yet solved the problem of how to use a local (phone) terminal to talk to the phone Modem.

  2. You need a terminal application/program to do any talking to the modem (remember, its a 2-way communication). So that's why you need a rooted device, since the root kit usually come with Busybox (that includes a microcom terminal program). Otherwise you have to write your own program.

  3. AFAIK. You can disconnect incoming calls in many other and easier ways than with AT commands.

Solution 3:[3]

Use syntax like this and let me know:

echo -e "AT+CFUN=?\r\n" > /dev/ttyUSB0

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 boettger1
Solution 2 not2qubit
Solution 3 Jason Plank