2G/3G
To determine your network type use:
TelephonyManager.getNetworkType();
here's some example code:
bool is3G = (manager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS);
Docs for the class can be found at: TelephonyManager
On/Off
To check if your telephone radio is on or off use:
ServiceState.getState();
To set it use:
ServiceState.setState(STATE_POWER_OFF);
It's unclear whether the setState method exists on all devices and functions in all states. There is no documentation for this method. Documentation for the class can be found at: ServiceState
This issue might also be relevant: http://code.google.com/p/android/issues/detail?id=1065
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…