@@ -5,32 +5,37 @@ The mobile SDK surfaces missing or required system permissions (Bluetooth, inter
55## Monitoring Permission Errors
66
77{% tabs %}
8-
98{% tab title="Android Kotlin" %}
109``` kotlin
1110coroutineScope.launch {
1211 SeamSDK .getInstance().credentials.collect { credentialsList ->
1312 val errors = credentialsList.flatMap { it.errors }
1413 errors.forEach { error ->
1514 when (error) {
16- is SeamCredentialError .Expired -> { /* handle credential expiration error */ }
17- is SeamCredentialError .Loading -> { /* handle not loaded yet */ }
18- is SeamCredentialError .Unknown -> { /* handle unknown error */ }
1915 is SeamCredentialError .UserInteractionRequired -> {
2016 handleUserInteractionRequired(error.interaction)
2117 }
18+ else -> { /* handle other errors */ }
19+ }
20+ }
21+ }
22+
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
2228 }
29+ else -> { /* handle other errors */ }
2330 }
2431 }
2532}
2633```
2734{% endtab %}
2835
2936{% tab title="iOS Swift" %}
30-
3137Use Combine to watch the published credentials array and handle permission-related errors:
3238
33-
3439``` swift
3540import SeamSDK
3641import Combine
@@ -54,15 +59,13 @@ func startMonitoringPermissionErrors() {
5459{% endtab %}
5560{% endtabs %}
5661
57-
5862The mobile SDK automatically clears resolved permission errors once the required permission is granted, reflecting the updated credential state.
5963
6064## Handling Permission Actions
6165
6266Implement your handler for each action:
6367
6468{% tabs %}
65-
6669{% tab title="Android Kotlin" %}
6770``` kotlin
6871fun handleUserInteractionRequired (interaction : SeamRequiredUserInteraction ) {
@@ -92,7 +95,6 @@ func handlePermissionAction(_ action: CredentialUserAction) {
9295{% endtab %}
9396{% endtabs %}
9497
95-
9698## See also
9799
98100For 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.
0 commit comments