1 問題
在Android8.0版本以后,開啟熱點我們采用的下面這種方式,但是跳轉頁面后熱點會斷開,手機不能互相傳文件了
權限說明:Android8.0需要位置權限和GPS權限,同時手機熱點還不能是開啟狀態。
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {try {mWifiManager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback() {@Overridepublic void onFailed(int reason) {super.onFailed(reason);Log.i(TAG, "onFailed start");}@Overridepublic void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) {super.onStarted(reservation);Log.i(TAG, "onStarted start");mReservation = reservation;WifiConfiguration wifiConfiguration = reservation.getWifiConfiguration();