Skip to content

Add method for permission state. #944

Open
@infacto

Description

@infacto

Should we add a method for the new Android 12+ permissions?

Method Description
isEnabled Reports if bluetooth is enabled.
isLocationEnabled Reports if location services are enabled.
isScanEnabled Reports if bluetooth can scan. (Android 12, API 31) new

How to test permission BLUETOOTH_SCAN? How to test if the bluetooth plugin is fully ready?
Is it possible to test the permission before using it?

My test: On Android 12 you only get the permission dialog two times. When you get the error "Bluetooth scan permission not granted." Btw. before this error the app event platform.pause is emitted and after this error platform.resume. That's weird. Another thing is, I have no idea where to enable BLUETOOTH_SCAN in Android settings. I cannot find it. Currently I have to uninstall the app and install again to trigger the permission dialog. We need a way to trigger this again or open settings if the user must manually enable it.

Btw. Are all errors always typeof string? For example on startScanWithOptions? Because we generally expect Error object. I could test string if includes scan and permission to handle this kind of error. ^^

Ref. #875

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions