randdusing / cordova-plugin-bluetoothle

Bluetooth Low Energy Phonegap Plugin
804 stars 353 forks source link

Unable simply Scan from a Clean-started project with Ionic-Capacitor #605

Open user1337 opened 4 years ago

user1337 commented 4 years ago

Hi there!

It there anyone who is capable to do a Ionic project with Capacitor that is capable of doing a Scan and getting "scanResult" ? I also got a success from "scanStarted".

I started by following the steps for Capacitor installation from : https://ionicframework.com/docs/native/bluetooth-le

Otherwise, I also start a Ionic project with "Cordova" and the Scan is working and I get scan results with some devices.

What I also did was :

Thanks, Huy

BetterAutomations commented 4 years ago

I tried the same and received this error in the console. Is that what you received?

2020-07-07 05:55:15.400 4026-4040/io.ionic.starter W/Binder: Binder call failed. java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results at android.os.Parcel.readException(Parcel.java:1693) at android.os.Parcel.readException(Parcel.java:1646) at android.bluetooth.IBluetoothGatt$Stub$Proxy.startScan(IBluetoothGatt.java:796) at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.onClientRegistered(BluetoothLeScanner.java:423) at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:56) at android.os.Binder.execTransact(Binder.java:573)

randdusing commented 4 years ago

Are you calling requestPermission() before hand?