Skip to content

Commit 290392d

Browse files
committed
Fixes after review
1 parent 10ed2e0 commit 290392d

File tree

6 files changed

+22
-50
lines changed

6 files changed

+22
-50
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,48 +33,17 @@
3333
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3434
xmlns:tools="http://schemas.android.com/tools">
3535
<!--
36-
Bluetooth permission is required on Android 4.3 - 11 in order to communicate with
37-
Bluetooth LE devices.
38-
-->
39-
<uses-permission
40-
android:name="android.permission.BLUETOOTH"
41-
android:maxSdkVersion="30"/>
42-
<!--
43-
Bluetooth Admin permission is required on Android 4.3 - 11 in order to scan for
44-
Bluetooth LE devices.
45-
-->
46-
<uses-permission
47-
android:name="android.permission.BLUETOOTH_ADMIN"
48-
android:maxSdkVersion="30"/>
49-
<!--
50-
Location permission is required from Android 6 to 11 to be able to scan for advertising
51-
Bluetooth LE devices. Some BLE devices, called beacons, may be used to position the phone.
52-
This is to ensure that the user agrees to do so.
36+
Location permission, it will replace any existing location permission in the merged manifest.
5337
This app does not use this location information in any way.
5438
Since Android 10 ACCESS_FINE_LOCATION is required and for that, the COARSE one also needs
5539
to be specified.
5640
-->
5741
<uses-permission
5842
android:name="android.permission.ACCESS_COARSE_LOCATION"
59-
android:maxSdkVersion="30"/>
43+
tools:node="replace" />
6044
<uses-permission
6145
android:name="android.permission.ACCESS_FINE_LOCATION"
62-
android:maxSdkVersion="30"/>
63-
<!--
64-
On Android 12 new set of Bluetooth permissions were added. BLUETOOTH_SCAN permission is
65-
needed to scan for Bluetooth LE devices. The "never for location" flag is set, as we are not
66-
interested in finding the user location, and we are OK with the fact, that beacons info
67-
will be removed from the scan results.
68-
-->
69-
<uses-permission
70-
android:name="android.permission.BLUETOOTH_SCAN"
71-
android:usesPermissionFlags="neverForLocation"
72-
tools:targetApi="s" />
73-
<!--
74-
This permission is required in order to connect to a Bluetooth LE device on Android 12
75-
onwards.
76-
-->
77-
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
46+
tools:node="replace" />
7847

7948
<application
8049
android:allowBackup="true"

permissions-wifi/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ plugins {
66
group = "no.nordicsemi.android.common"
77

88
nordicNexusPublishing {
9-
POM_ARTIFACT_ID = "permissions-nfc"
10-
POM_NAME = "Nordic library for checking required nfc permission."
9+
POM_ARTIFACT_ID = "permissions-wifi"
10+
POM_NAME = "Nordic library for checking permissions required for scanning for Wi-Fi networks."
1111

1212
POM_DESCRIPTION = "Nordic Android Common Libraries"
1313
POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries"

permissions-wifi/src/main/AndroidManifest.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!--
1+
<?xml version="1.0" encoding="utf-8"?><!--
32
~ Copyright (c) 2023, Nordic Semiconductor
43
~ All rights reserved.
54
~
@@ -30,15 +29,13 @@
3029
~ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3130
-->
3231

33-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
34-
xmlns:tools="http://schemas.android.com/tools">
32+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33+
3534
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
3635
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
3736
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
38-
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
37+
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
3938

40-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
41-
tools:node="replace" />
42-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
43-
tools:node="replace" />
39+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
40+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
4441
</manifest>

permissions-wifi/src/main/java/no/nordicsemi/android/common/permissions/wifi/view/WifiPermissionRequiredView.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,17 @@ import no.nordicsemi.android.common.permissions.wifi.viewmodel.PermissionViewMod
6363
import no.nordicsemi.android.common.theme.NordicTheme
6464
import no.nordicsemi.android.common.theme.view.WarningView
6565

66-
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
6766
@Composable
6867
internal fun WifiPermissionRequiredView() {
6968
val viewModel: PermissionViewModel = hiltViewModel()
7069
val context = LocalContext.current
71-
var permissionDenied by remember { mutableStateOf(viewModel.isWifiPermissionDeniedForever(context)) }
70+
var permissionDenied by remember {
71+
mutableStateOf(
72+
viewModel.isWifiPermissionDeniedForever(
73+
context
74+
)
75+
)
76+
}
7277

7378
WarningView(
7479
imageVector = Icons.Default.WifiOff,
@@ -79,7 +84,8 @@ internal fun WifiPermissionRequiredView() {
7984
.verticalScroll(rememberScrollState())
8085
) {
8186
val requiredPermissions = arrayOf(
82-
Manifest.permission.NEARBY_WIFI_DEVICES,
87+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
88+
Manifest.permission.NEARBY_WIFI_DEVICES else Manifest.permission.CHANGE_WIFI_STATE,
8389
)
8490

8591
val launcher = rememberLauncherForActivityResult(

permissions-wifi/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<string name="wifi_disabled_des">Wi-Fi is disabled. Please enable Wi-Fi to scan for Wi-Fi networks.</string>
3939
<string name="enable_wifi">Enable Wi-Fi</string>
4040
<string name="wifi_not_available">WI-FI NOT AVAILABLE</string>
41-
<string name="wifi_not_available_des">Wi-Fi is not available on this device. We won\'t be able to provision the device.</string>
41+
<string name="wifi_not_available_des">Wi-Fi is not available on this device.</string>
4242

4343
<string name="grant_permission">Grant Permission</string>
4444
<string name="settings">Settings</string>

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ include(":analytics")
5959
include(":permissions-ble")
6060
include(":permissions-internet")
6161
include(":permissions-nfc")
62-
include(":data")
6362
include(":permissions-wifi")
63+
include(":data")

0 commit comments

Comments
 (0)