1

I'm developing an application in Android which requires some AT commands to be sent to the modem.

These commands include things like extracting the IMEI number, iterating available networks and setting APN details.

I have a Windows (c#) version of this software, so I'm familiar with the commands I need to send, but in Windows I can simply open the relevant Serial Port and send the commands.

Edit:

I've discovered that some functions of the modem are exposed with the TelephonyManager API

TelephonyManager telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); 
String SerNum= telMgr.getSimSerialNumber();
String IMEI= telMgr.getDeviceId();
String Operator= telMgr.getSimOperatorName();

Which has helped quite a bit, but there doesn't seem to be a way of setting the network operator/provider manually.. which is the main thing I need.

Michael M.
  • 10,486
  • 9
  • 18
  • 34
Rich S
  • 3,248
  • 3
  • 28
  • 49

2 Answers2

0

According to this fellow there is no public API to do what you want, which I'm inclined to believe based on my experiences with the various modems in Android and the fact that the TelephonyManager page has nothing.

You might be able to do this using reflection to get access to non-public methods (similar to how WiMax management must be done, an example here), but that probably won't work on all devices/OS versions, and because of security purposes, you might also need to be rooted for such a thing to work.

Community
  • 1
  • 1
berwyn
  • 986
  • 7
  • 23
  • yeah, everything I've read so far indicates that it can't be done, which is why I posted this specific question, just in case anybody DOES have a way of doing it. – Rich S Sep 25 '12 at 14:59
  • Yeah, I'm rather curious to see if anything turns up. It's something I wanted to do at one point for a remote device management app. – berwyn Sep 26 '12 at 12:28
0

I worked on customized system and integrated a GSM modem. I suggest you enable and look at the "radio" log using logcat. There is a lot to learn from it (at least I did). There is a config file containing a list of APN and when connecting, you you will see it looks for the "preferred APN". In my system, it is the APN in that file. Since there is almost no info on how to play a lower level in Android (info is available at the app level only), I use (and sacrificed) a few "off the shelf" systems to look at how it works and then customized for my custom one. The area around the telephony seems to be one of the place where the different manufacturers/carriers add there own flavours since I could note differences in each system with the same Android version (Froyo, gingerbread etc). Unfortunately, this is not a straight answer but I hope this bit of info could help.

Also, a little warning about trying to sent AT commands directly to your Modem. The RIL is constantly interacting with the modem and manages the AT commands back and forth. It will be upset about receiving some answers to commands it does not know were sent. The RIL constantly check the signal strength and a bunch of things and manages all the unsolicited messages from the Modem that might require the RIL or Android/connectivity manager to take action upon.

Sylvain Huard
  • 1,378
  • 6
  • 18
  • 29