6

I am writing an application where I need to have specifically a GPRS connection, even if wifi or 3G (or better) is available. I have figured out how to disable wifi (by using WifiManager), however, I can't seem to find out how I can programmatically disable 3G and only use a GPRS connection, with equal effect as changing this manually in the device settings.

Is there a way to do this with code?

UPDATE: What I am looking for does not necessarily have to be in the public Android APIs. It might as well be in one of the undocumented APIs, or as a last resort, device-specific APIs, I just need something that works. However, I'd rather not have to root a device to use these functions.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Frxstrem
  • 38,761
  • 9
  • 79
  • 119

3 Answers3

2

The issue is not just private APIs but that a 3rd party APK cannot get permission to modify such a setting.

As a result, doing so would require a rooted device in addition to reverse engineering private interfaces.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
0

as far as i know changing the type of the mobile network is not possible out from an app.

hauns
  • 116
  • 1
  • 6
  • I know of at least one application which seems to have this capabiliy (namely the [Extended Controls](https://market.android.com/details?id=com.extendedcontrols) application), so I don't think it is impossible – Frxstrem Aug 18 '11 at 09:37
  • @Frxstream - have you verified that on a non-rooted device? "possible from an app" tends to refer to what Android is designed to allow apps to do, launching helper processes as the superuser not being a designed capability. – Chris Stratton Aug 20 '11 at 17:44
0

In android framework, TelephonyManager is the object providing Telephony service to android application.
see http://developer.android.com/reference/android/telephony/TelephonyManager.html
The service do provide several methods to know state and information of your physical radio component.

But there is no way to modify the way the physical radio component of your device do its job. Its a private logic of your device manufacturer that try to do its best to comply radiophony industrial standard and provide the best end user experience quality

This is an public api android point of view (over dalvik) answer, do not answer in context of private android api, nor native way nor root privileged way.

Emmanuel Devaux
  • 3,327
  • 4
  • 25
  • 30