Corodva-android 9.0.0 - Ionic 4 cordova BLE plugin does not work with cordova-android 9.0.0

I have an ionic 4 app where I am using the plugin with cordova-android - “^8.1.0”.

I just updated to cordova-android 9.0.0.

The ble.scan function is no longer returning anything.

A simple test case is:

    this.ble.scan([], 5).subscribe(device => {

If I revert back to cordova-android 8.1.0 it works fine.

One other item of note is that when I first launch the app with cordova-android 8 it has a popup that has 3 options - use location services all the time, use location services only when using the app, and to not use location services. When I update to cordova-android 9 the first option (use all the time) is no longer part of the pop up. Don’t know if it is related or not.

Is anyone else experiencing this issue?

Has anyone else updated to cordova-android 9.0.0?

If so what did you do to resolve it?


I have created a simple test case using ionic 5. I use the BLE plugin directly.

In the test I try the scan method as follows:

 scan() {
    ble.scan([], 5, function(device) {
    }, function() {
      console.log('Scan failed');

      function() { console.log("Scan complete"); },
      function() { console.log("stopScan failed"); }

If I have the following set in the config.xml the scan does not work. When the method is called it provides no feedback (i.e. no failure condition, nothing).

    <preference name="android-minSdkVersion" value="22" />
    <preference name="android-targetSdkVersion" value="29" />

By default the target SDK for cordova-android is 29.

If I change the target SDK value from 29 to 28 the scan and other plugin methods function properly.

A repo of this simple test case can be found here:


While I do not have a solution. I can confirm that targeting SDK 29 does in fact break BLE scanning.

One difference I did find though:

WIth SDK 28, Android will prompt to allow location access:

“Allow all the time”
“Allow only when using the app”

However with SDK 29 targeted, the only options presented are:

“Allow only when using the app”

  • Chris

Looks like there is an open issue for this. A workaround is described there as well. It involves making a request for location information from the GPS before you start scanning with BLE.

For whatever reason, Ionic does not allow linking to github, so you’ll have to fix this link:

git hub . com /don/cordova-plugin-ble-central/issues/803

I have tested it as follow and it does appear to work:

  1. Add the geolocation plugin
cordova plugin add cordova-plugin-geolocation --variable GPS_REQUIRED="false"
  1. Before calling scan, request a GPS location
try { navigator.geolocation.getCurrentPosition (function () {}, function () {}); } catch (e) { }

Hope that helps.

  • Chris