cordova-plugin-bluetoothle icon indicating copy to clipboard operation
cordova-plugin-bluetoothle copied to clipboard

Request Permission

Open willishf opened this issue 5 years ago • 2 comments

Using the API to do some testing and noticed that if I completely uninstall the app that was working prior and ask bluetoothle.isLocationEnabled(locationRequestPermission, handleError); will get a true returned so don't make a call to bluetoothle.requestPermission(locationRequestionPermissionSuccess, handleError); under the assumption everything is good. Go through and do the startScan and it reports it is scanning but get no events.

If I manually call bluetoothle.requestPermission(locationRequestionPermissionSuccess, handleError); via a separate button action will get prompted to give permission. The blue tooth init code will now work and I will get Bluetooth events. Quit the app and come back in and everything works. Ask again via the button to request permission do not get the pop up asking user for permission.

The bug seems to be triggered by an uninstall and then reinstall of the app.

Does appear can be solved by always asking for permission.

willishf avatar Jul 03 '20 18:07 willishf

Why not query hasPermission first and then query requestPermission if needed? After that, see if location is enabled. The popup will only appear once per app install or else developers could spam a user.

randdusing avatar Jul 03 '20 18:07 randdusing

Somehow I mentally associated isLocationEnabled as the hasPermission for requestPermission.

Thanks for the quick response.

On Fri, Jul 3, 2020 at 2:33 PM Rand Dusing [email protected] wrote:

Why not query hasPermission first and then query requestPermission if needed? After that, see if location is enabled. The popup will only appear once per app install or else developers could spam a user.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/randdusing/cordova-plugin-bluetoothle/issues/623#issuecomment-653644795, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA653HRLZFKPLC76VYT7F7LRZYP77ANCNFSM4OP7ZI5Q .

willishf avatar Jul 03 '20 20:07 willishf