views:

68

answers:

1

In my application it is necessary to have internet connection. Therefore i check while starting if a Internet connection is availaible. If not I ask the user if he would establish an Internet Connection, and what type (wifi oder mobile).

The wifi connection i can establish with the following code

WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);

But how do i establish a mobile connection? Coulnd't find a single code snippet at Google.

+1  A: 

You can check this project. You should enable the APN.

Macarse