randdusing / cordova-plugin-bluetoothle

Bluetooth Low Energy Phonegap Plugin
803 stars 354 forks source link

Plug-in not discovering devices when packaged into an APK #488

Open tempestwf opened 6 years ago

tempestwf commented 6 years ago

Hi

The plugin is working perfectly when running:

ionic cordova run android --device

To deploy to a device from my computer.

However, if we run:

ionic cordova build --debug android

To make an APK, and then when we install the APK scanning happens just fine (from startScan method we get status: scanStarted), but no device is ever discovered ( we never get: status:scanResult).

I should also note that the standard BLE plugin (cordova-plugin-ble-central) is able to discover devices when in an APK. However, that plugin has its own issues that have made it not viable for us to use.

Has anyone encountered this before or has any suggestions?

I am testing on a Samsung Galaxy A Tablet with Android Version 7.0.

We are building our application in Ionic. Here are some entries from package.json so you can see what versions we are running:

"@angular/core": "^5.2.3",
"@ionic-native/core": "4.7.0",
"cordova-android": "7.0.0",

Thanks very much.

Will

tempestwf commented 6 years ago

Updating with more exact info about the issue.

tempestwf commented 6 years ago

We were able to solve this problem. It turns out that https://github.com/randdusing/cordova-plugin-bluetoothle#requestpermission must be called when the application is packaged into an APK. It's not an issue when using ionic cordova run android, however.

Not sure why there is a difference, but that is the fix.

randdusing commented 6 years ago

You may have previously allowed permission when using ionic run, and then when you deployed the release apk, it may require permissions to be requested.

tempestwf commented 6 years ago

Thanks Rand

The problem doesn't seem to be happening any more. We made some major changes to our implementation of the plugin, and this and some other issues went away.

All the best

Will

On Sat, Jun 23, 2018 at 9:43 AM, Rand Dusing notifications@github.com wrote:

You may have previously allowed permission when using ionic run, and then when you deployed the release apk, it may require permissions to be requested.

— 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/488#issuecomment-399691998, or mute the thread https://github.com/notifications/unsubscribe-auth/AaH3bbmyVRAsf6LgaLI6C2kBoPVlXvAuks5t_nAngaJpZM4UqryR .