Question

Disclaimer - I know how calling non-API methods can affect my application. It's not going to be published on Google Play, I'm creating it just for personal use.

Task - get available network operators on rooted phone (Android 2.3.3). Model is known.

What have I tried

A lot of reflection:

  • Tried to get PhoneFactory, get default Phone (getDefaultPhone) or GSMPhone. I've received an actual reference to PhoneProxy and was able to call getAvailableNetworks which returned an CommandException - RADIO_NOT_AVAILABLE
  • Tried to instantinate RIL directly. Tried to call getAvailableNetworks here with the same result (RADIO_NOT_AVAILABLE). Tried to call registerForAvaiable which never sends message back to Handler.
  • Tried to connect LocalSocket to "rild". Getting IOException: Permission denied

I've tried everything above with my app stored at /system/app/ - results are same.

Question

  1. Is it even possible to access RIL methods without signing my app with system key or using custom Android build?
  2. Maybe I can overcome this issues by building app directly for Linux?
  3. Any advice on this problem is highly appreciated.
Was it helpful?

Solution 2

You can build you own RIL implementatiion. You can tell Android to load your library by setting the android propety rild.lib. On a rooted phone you can do

getprop | grep ril

to see your current used rild library.

There are opensource ril implementations for sierra gsm dongles / huawei dongles etc. You will get an idea.

But not everything is easily possible. With this mechanism you can only implement the call backs that android is making to you. E.g. it does not allow you to make a data roaming connection. That is still controlled by the android framework.

To change your current rild library to your own you can set

setprop rild.lib \system\modules\yourlibrary.so 

see also http://www.kandroid.org/online-pdk/guide/telephony.html

OTHER TIPS

Interesting question - it would be great if we could access the RIL.

On XDA I sometime find apps that display RIL info. When I look closer I usually find that they are invoking a keypad code and then parsing the output - not calling an API. Oh, here's one of those apps. (This method is manufacturer specific.)
http://forum.xda-developers.com/showthread.php?t=1687249

Here's a post about PhoneFactory etc.
https://stackoverflow.com/a/6504808/150016

And here's a very good discussion on that topic:
Can a telephony.Phone object be instantiated through the sdk?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top