Skip to content

Commit 65689de

Browse files
dawnhogitbook-bot
authored andcommitted
GITBOOK-683: Mobile SDK improvements - apple suppression
1 parent 48812c2 commit 65689de

File tree

2 files changed

+88
-26
lines changed

2 files changed

+88
-26
lines changed

docs/capability-guides/mobile-access/mobile-device-sdks/handling-system-permissions.md

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,61 @@
22

33
The mobile SDK surfaces missing or required system permissions (Bluetooth, internet connectivity, and so on) as `CredentialError.userInteractionRequired(action)` entries in each credential’s `errors` array. After activation, observe these errors and handle the specified actions. Errors update automatically as requirements change.
44

5-
## Monitoring Permission Errors
5+
***
6+
7+
## Platform Setup Requirements
8+
9+
First, configure the required platform capabilities.
610

711
{% tabs %}
12+
{% tab title="iOS Swift" %}
13+
1. **Suppress Apple Wallet while unlocking with BLE**\
14+
To prevent the Apple Wallet dialog from appearing when your app uses BLE to unlock a door, do the following:
15+
16+
* Add the `requestAutomaticPassPresentationSuppression()` call to your app.\
17+
This method suppresses Apple Wallet while your mobile app is in the foreground and ensures a smoother `unlockWithTap` experience.
18+
* Request the `com.apple.developer.passkit.pass-presentation-suppression` entitlement from Apple. 
19+
20+
Apple Wallet suppression and Bluetooth scanning only apply while the app is in the foreground. Ensure unlock operations are initiated while the app is active.
21+
2. **Enable Bluetooth capability**
22+
23+
Add the required Bluetooth key to your app’s entitlements file:
24+
25+
```xml
26+
<dict>
27+
<key>com.apple.security.device.bluetooth</key>
28+
<true/>
29+
</dict>
30+
```
31+
{% endtab %}
32+
833
{% tab title="Android Kotlin" %}
9-
```kotlin
10-
coroutineScope.launch {
11-
SeamSDK.getInstance().credentials.collect { credentialsList ->
12-
val errors = credentialsList.flatMap { it.errors }
13-
errors.forEach { error ->
14-
when (error) {
15-
is SeamCredentialError.UserInteractionRequired -> {
16-
handleUserInteractionRequired(error.interaction)
17-
}
18-
else -> { /* handle other errors */ }
19-
}
20-
}
21-
}
34+
1. **Request Bluetooth permissions**
2235

23-
fun handleUserInteractionRequired(interaction: SeamRequiredUserInteraction) {
24-
when (interaction) {
25-
is SeamRequiredUserInteraction.GrantPermissions -> {
26-
/* handle permissions error */
27-
// interaction.permissions contains the list of required permissions
28-
}
29-
else -> { /* handle other errors */ }
30-
}
31-
}
32-
}
33-
```
36+
Define and call a helper function in your app to request the necessary Bluetooth permissions at runtime.
37+
2. **For Android 12 (API 31) and newer:**
38+
39+
```
40+
Manifest.permission.BLUETOOTH_SCAN
41+
Manifest.permission.BLUETOOTH_CONNECT
42+
Manifest.permission.BLUETOOTH_ADVERTISE
43+
```
44+
3. **For Android 11 (API 30) and older:**
45+
46+
```
47+
Manifest.permission.BLUETOOTH
48+
Manifest.permission.BLUETOOTH_ADMIN
49+
Manifest.permission.ACCESS_COARSE_LOCATION
50+
Manifest.permission.ACCESS_FINE_LOCATION
51+
```
52+
53+
See [Android request permissions](https://developer.android.com/training/permissions/requesting) for more details.
3454
{% endtab %}
55+
{% endtabs %}
56+
57+
## Monitoring Permission Errors
3558

59+
{% tabs %}
3660
{% tab title="iOS Swift" %}
3761
Use Combine to watch the published credentials array and handle permission-related errors:
3862

@@ -56,10 +80,40 @@ func startMonitoringPermissionErrors() {
5680
}
5781
}
5882
```
83+
84+
The mobile SDK automatically clears resolved permission errors once the required permission is granted, reflecting the updated credential state.
5985
{% endtab %}
60-
{% endtabs %}
86+
87+
{% tab title="Android Kotlin" %}
88+
```kotlin
89+
coroutineScope.launch {
90+
SeamSDK.getInstance().credentials.collect { credentialsList ->
91+
val errors = credentialsList.flatMap { it.errors }
92+
errors.forEach { error ->
93+
when (error) {
94+
is SeamCredentialError.UserInteractionRequired -> {
95+
handleUserInteractionRequired(error.interaction)
96+
}
97+
else -> { /* handle other errors */ }
98+
}
99+
}
100+
}
101+
102+
fun handleUserInteractionRequired(interaction: SeamRequiredUserInteraction) {
103+
when (interaction) {
104+
is SeamRequiredUserInteraction.GrantPermissions -> {
105+
/* handle permissions error */
106+
// interaction.permissions contains the list of required permissions
107+
}
108+
else -> { /* handle other errors */ }
109+
}
110+
}
111+
}
112+
```
61113

62114
The mobile SDK automatically clears resolved permission errors once the required permission is granted, reflecting the updated credential state.
115+
{% endtab %}
116+
{% endtabs %}
63117

64118
## Handling Permission Actions
65119

@@ -95,6 +149,8 @@ func handlePermissionAction(_ action: CredentialUserAction) {
95149
{% endtab %}
96150
{% endtabs %}
97151

152+
***
153+
98154
## See also
99155

100156
For a complete SwiftUI-based implementation of credential error handling for iOS, see `SeamUnlockCardView` in the SeamComponents library, which demonstrates observing credential errors and updating the UI accordingly.

docs/capability-guides/mobile-access/mobile-device-sdks/using-unlock-with-tap.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ Use Async/Await or Combine to initiate an unlock with a selected credential:
118118

119119
{% tabs %}
120120
{% tab title="iOS Swift" %}
121+
{% hint style="info" %}
122+
If the Apple Wallet dialog appears when using the BLE unlock, see [Handling System Permissions](handling-system-permissions.md#platform-setup-requirements) for steps to prevent it and ensure a smoother unlockWithTap experience.
123+
{% endhint %}
124+
121125
```swift
122126
import SeamSDK
123127
import Combine
@@ -245,6 +249,8 @@ fun handleCredentialErrors(credentialErrors: List<SeamCredentialError>) {
245249
{% endtab %}
246250
{% endtabs %}
247251

252+
***
253+
248254
## 4. Handle Unlock Events
249255

250256
Handle each `SeamUnlockEvent` to update your UI and logic. Available events:

0 commit comments

Comments
 (0)