diff --git a/app/src/main/java/com/farmerbb/secondscreen/fragment/ProfileEditFragment.java b/app/src/main/java/com/farmerbb/secondscreen/fragment/ProfileEditFragment.java index 379b00b..218273c 100644 --- a/app/src/main/java/com/farmerbb/secondscreen/fragment/ProfileEditFragment.java +++ b/app/src/main/java/com/farmerbb/secondscreen/fragment/ProfileEditFragment.java @@ -306,7 +306,7 @@ public void onCreate(Bundle savedInstanceState) { if(!getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) disablePreference("bluetooth_on", "additional_settings", true); - if(!getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) + if(!U.canEnableWifi(getActivity())) disablePreference("wifi_on", "additional_settings", true); if(!getActivity().getPackageManager().hasSystemFeature("com.cyanogenmod.android")) diff --git a/app/src/main/java/com/farmerbb/secondscreen/service/ProfileLoadService.java b/app/src/main/java/com/farmerbb/secondscreen/service/ProfileLoadService.java index ce9ba68..7ca266a 100644 --- a/app/src/main/java/com/farmerbb/secondscreen/service/ProfileLoadService.java +++ b/app/src/main/java/com/farmerbb/secondscreen/service/ProfileLoadService.java @@ -191,7 +191,7 @@ private void loadProfile(SharedPreferences prefCurrent) { } // Wi-Fi - if(getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) { + if(U.canEnableWifi(this)) { WifiManager wifi = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); if(prefCurrent.getBoolean("not_active", true)) editor.putBoolean("wifi_on_system", wifi.isWifiEnabled()); diff --git a/app/src/main/java/com/farmerbb/secondscreen/util/U.java b/app/src/main/java/com/farmerbb/secondscreen/util/U.java index f6467bb..3ab87b4 100644 --- a/app/src/main/java/com/farmerbb/secondscreen/util/U.java +++ b/app/src/main/java/com/farmerbb/secondscreen/util/U.java @@ -1558,4 +1558,9 @@ public static boolean canEnableOverscan() { public static boolean canEnableImmersiveMode() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && U.getCurrentApiVersion() <= 29.0f; } + + public static boolean canEnableWifi(Context context) { + return Build.VERSION.SDK_INT < Build.VERSION_CODES.Q + && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI); + } } \ No newline at end of file