简体   繁体   中英

Android Application: Got Internet Connection

如何检查是否有成功的互联网连接(Wifi / 3G /其他)我已经向用户显示错误,如果他们没有Wifi连接但我怎么能确定用户是否有3G连接如果他们希望连接使用没有Wifi连接的应用程序?

If you just want to see if the phone is connected to the network, you could try: ConnectivityManager.getAllNetworkInfo() and then for each network adapter check networkinfo.getState() . That should tell you whether it's connected or not. However, I'm not sure if there's a way to specifically check for 3G.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM