[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)

Last post by glover.bridget
4 hours ago
sony sp
Started by dickens.macey
Last post by frederick22
4 hours ago
Last post by daphney66
1 hour ago
Last post by gutkowski.enoch
2 hours ago
Last post by fabiola85
2 hours ago
Last post by veronica.oconnell
3 hours ago
Last post by kaelyn.waters
2 hours ago
Last post by kelli81
35 minutes ago
Last post by tcummerata
1 hour ago