This is not part of the public SDK at all - the functionality uses internal telephony APIs, as you can see from the Settings application source code .
This is a universal setting for the entire device in any case, so users will not be very pleased that you are violating their data connectivity, switching between 2G and 3G anyway.
source share