Binding to cellular network with bindProcessToNetwork does not work

前端 未结 1 1467
轮回少年
轮回少年 2021-01-23 11:31

I am trying to bind to a cellular network on demand (wifi is still running). I have the following code:

            override fun onAvailable(network: Network) {
         


        
1条回答
  •  爱一瞬间的悲伤
    2021-01-23 12:05

    Android exposes a property through developer options that allows you keep mobile data always active. Enabling this flag allows you to switch between wifi and cellular data connections and make successful network requests on the requested network immediately.

    This flag is also defined as a global setting.

    Settings.Global.MOBILE_DATA_ALWAYS_ON

    https://github.com/aosp-mirror/platform_frameworks_base/blob/e80b45506501815061b079dcb10bf87443bd385d/services/core/java/com/android/server/ConnectivityService.java#L951

    0 讨论(0)
提交回复
热议问题