启用移动网络 [英] Enable mobile network
本文介绍了启用移动网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序,需要有互联网连接。因此我检查同时启动,如果互联网连接availaible。如果不是我询问用户是否愿意建立互联网连接,以及什么类型的(无线移动奥德)。
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).
WiFi连接我可以用下面的code建立
The wifi connection i can establish with the following code
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);
但我怎么建立一个移动连接? Coulnd't在谷歌找到一个code片段。
But how do i establish a mobile connection? Coulnd't find a single code snippet at Google.
推荐答案
您可以检查这项目。
您应该启用的APN。
You can check this project. You should enable the APN.
这篇关于启用移动网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文