Android Multicast socket stops listening

后端 未结 2 625
我在风中等你
我在风中等你 2021-01-20 09:59

I have a service on Android that listens and responds to packets it receives via multicast.

This works most of the time, but unfortunately, I\'m finding that every n

2条回答
  •  终归单人心
    2021-01-20 10:57

    Note: This answer was meaningful when the question was asked in 2010, it is probably irrelevant today.

    I would think that changing wireless networks is pretty much akin to disabling and re-enabling the network (likely with a different IP and routing), so no surprise that things break.

    Perhaps registering for changes in the network info would give you the needed warning?

    http://developer.android.com/reference/android/net/ConnectivityManager.html#CONNECTIVITY_ACTION

    and associated pages

提交回复
热议问题