Skip to content

Commit 28d1b70

Browse files
authored
Merge pull request #72 from bondparkerbond/permissions-fix
Don't request special permissions on SDK 24+ when calling forceWifiUsage
2 parents d45f3bc + a9822aa commit 28d1b70

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

android/src/main/java/com/devstepbcn/wifi/AndroidWifiModule.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ public void forceWifiUsage(boolean useWifi) {
106106
if (useWifi) {
107107
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
108108

109-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
109+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
110+
canWriteFlag = true;
111+
// Only need ACTION_MANAGE_WRITE_SETTINGS on 6.0.0, regular permissions suffice on later versions
112+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
110113
canWriteFlag = Settings.System.canWrite(reactContext);
111114

112115
if (!canWriteFlag) {
@@ -520,4 +523,3 @@ public void onReceive(Context c, Intent intent) {
520523
}
521524
}
522525
}
523-

0 commit comments

Comments
 (0)