This release introduces the following behavior changes to the Wi-Fi and networking APIs.
- Your apps can now change the state of
WifiConfiguration
objects only if you created these objects. You are not permitted to modify or deleteWifiConfiguration
objects created by the user or by other apps. - Previously, if an app forced the device to connect to a specific Wi-Fi network by using
enableNetwork()
with thedisableAllOthers=true
setting, the device disconnected from other networks such as cellular data. In This release, the device no longer disconnects from such other networks. If your app’stargetSdkVersion
is“20”
or lower, it is pinned to the selected Wi-Fi network. If your app’stargetSdkVersion
is“21”
or higher, use the multinetwork APIs (such asopenConnection()
,bindSocket()
, and the newbindProcessToNetwork()
method) to ensure that its network traffic is sent on the selected network.
- 在過去APP可以進行修改手機中已連接過的Wi-FI設定值,也就是WifiConfiguration ,可以刪除/修改,但是在Android 6.0開始,您只能夠刪除/修改由APP本身建立的WifiConfiguration ,意思是說如果我想要把修改手機內某一個SSID的密碼,並自動連上它,是不會有效的,除非它是由您的APP新增而來的,若是手機中由使用者去手動輸入密碼的,或是其他APP建立的,都不行。
- 過去,當您的手機連上Wi-Fi後,4G連線會被強制中斷,但在這次的6.0釋出中,裝置將不會與4G保持長時間的中斷,當您的APP targetSdkVersion <21時,它將會保持在您所選的Wi-Fi中,但targetSdkVersion >=21時,需要使用multinetwork APIs 來保證您所要傳輸的資料,會由您所選擇的網路(Wi-Fi / 4G)傳輸出去,例如
openConnection()
,bindSocket()
或是bindProcessToNetwork()
方法。
沒有留言:
張貼留言