[Q] How select preferred network operators automatically?

Hallo,

I want to select preferred network operators automatically from device.

After I search for it, I found following:

Code:
final int EVENT_AUTO_SELECT_DONE = 300; Message msg = mHandler.obtainMessage(EVENT_AUTO_SELECT_DONE); phone.setNetworkSelectionModeAutomatic(msg);

So I need an instance of class "Phone". I tried this:

Code:
String phoneFactoryName = "com.android.internal.telephony.PhoneFactory"; String phoneName = "com.android.internal.telephony.Phone"; Class phoneFactoryClass = Class.forName(phoneFactoryName); Class phoneClass = Class.forName(phoneName); Method getDefaultPhone = phoneFactoryClass.getMethod("getDefaultPhone"); Object phoneObject = getDefaultPhone.invoke(null);

But the method "getDefaultPhone" can only called by looper.

Next I tried this:

Code:
String phoneAppName = "com.android.phone.PhoneApp"; Class phoneAppClass = Class.forName(phoneAppName); Method getInstanceMethod = phoneAppClass.getMethod("getInstance"); Object phoneObject = getInstanceMethod.invoke(null);

But I get a ClassNotFoundException.

Can anybody help me, please?

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

MTTY
Started by lennie.schmitt
Last post by dallas67
2 hours ago
Last post by zwilkinson
3 hours ago
Last post by qheaney
3 hours ago
Last post by gvon
48 minutes ago
Last post by hayes.pattie
40 minutes ago
Last post by al04
2 hours ago
Last post by ularkin
34 minutes ago
[Q] HTC HD2
Started by tking
Last post by evan.harber
24 minutes ago
Last post by kelvin.yundt
3 hours ago
Last post by cquigley
1 hour ago
Last post by madonna11
3 hours ago
Netflix?
Started by gsporer
Last post by roel49
1 hour ago
Last post by smckenzie
3 hours ago