Search code examples
androidgprs

How to force a GPRS connection instead of 3G or Wifi?


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.


Solution

  • 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.