How do I check whether a WP8 device uses wifi, mobile plan or roaming to load data

后端 未结 3 1568
悲&欢浪女
悲&欢浪女 2020-12-20 07:03

I plan to load only as much data as required in my app. Which means, that when the data is loaded via Wifi, I want to prefetch things. If the data is loaded via mobile plan

3条回答
  •  粉色の甜心
    2020-12-20 07:37

    The phone can use both 3G and WiFi at the same time. The case I've tested - the phone haven't close existing TCP connections opened while on 3G after it found and connected to a WiFi network. If a new TCP connection is opened it'll use WiFi instead.

    There's SocketExtensions.GetCurrentNetworkInterface extension method from Microsoft.Phone.dll that tell you which interface is used for the specified socket.

提交回复
热议问题