Cordova Plugin for Estimote Beacons

Hello :slight_smile:

i have a question. Is there any plugin for cordova/ionic to work with estimote beacons? the only plugins i found are a little bit old and it seems they wont work …

maybe someone of you have a cordova app and beacons running…

Hi @torbengabriel,

here is a Cordova plug-in we maintain at Lekooa, only for beacons and not for stickers. We updated the most wanted methods like ranging, monitoring and device discovering. Conenction is done too.

Hope it works for you :slight_smile:

1 Like

hey :slight_smile: Thanks for the reply.

i try to download the project an run the example… hope it will run :slight_smile:

1 Like

i downloaded the example and added both plugins, the whitelist one and the evothings plugin… but nothing works when i run the app and click range beacons or something else…

The range beacon is working for me :frowning:

@torbengabriel,

I had not update the example README, you have to add this plug-in:

cordova plugin add https://github.com/Lekooa/phonegap-estimotebeacons.git

and not the evothings’s one.

I updated the readme ty :slight_smile:

1 Like

thanks again but i got an error while installing…

Can you try deleting the plug-in and re-installing it to be sure:
> cordova plugin rm cordova-plugin-estimote
> cordova plugin add https://github.com/Lekooa/phonegap-estimotebeacons.git

i will try…

but in which folder/project should i install the plugins? in the master folder or in the examples - beacon-finder folder?

  • the first step is to clone the GitHub project:
    git clone https://github.com/Lekooa/phonegap-estimotebeacons.git
  • after, go to the example folder:
    cd phonegap-estimotebeacons/examples/beacon-finder
  • here, add the plug-ins you need:
    cordova plugin add cordova-plugin-whitelist
    cordova plugin add https://github.com/Lekooa/phonegap-estimotebeacons.git
  • you can now add the platform you want to use:
    cordova platform add android
  • for Android, open the project located at beacon-finder/platforms/android and run it
  • for iOS, open the Xcode project located at beacon-finder/platforms/ios and run it.

Hope I didn’t do any mistake :slight_smile:

Cloned the project again with your steps…

but if i click range beacons and the site opens… nothings happens. i see the back button. But the above template is white/empty…

What are saying the logs?

Also, are you using some Secure beacons? It could be that.

08-02 15:56:59.054 22373-22447/com.evothings.beaconfinder D/EstimoteBeacons: The region to range: BeaconRegion{identifier=0:0:0, proximityUUID=null, major=null, minor=null, secure=false}.
08-02 15:56:59.057 22373-22447/com.evothings.beaconfinder E/EstimoteSDK: SystemRequirementsHelper.checkAllPermissions:169 Your app is targeting Android M (SDK 23). You need to acquire one the location permissions: ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION
08-02 15:56:59.057 22373-22447/com.evothings.beaconfinder D/EstimoteBeacons: Connected to BeaconService.
08-02 15:56:59.057 22373-22447/com.evothings.beaconfinder D/EstimoteBeacons: Start ranging region: 0:0:0.
08-02 15:57:00.619 22373-23075/com.evothings.beaconfinder D/BluetoothAdapter: isLeEnabled(): ON
08-02 15:57:00.628 28180-28201/? D/BtGatt.GattService: registerClient() - UUID=3c628cce-9d77-4eca-8427-86ad0df59a3f
08-02 15:57:00.632 28180-28200/? D/BtGatt.GattService: onClientRegistered() - UUID=3c628cce-9d77-4eca-8427-86ad0df59a3f, clientIf=5
08-02 15:57:00.634 22373-22385/com.evothings.beaconfinder D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5 mClientIf=0
08-02 15:57:00.634 28180-28229/? D/BtGatt.GattService: start scan with filters
08-02 15:57:00.640 22373-22385/com.evothings.beaconfinder 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:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at android.bluetooth.IBluetoothGatt$Stub$Proxy.startScan(IBluetoothGatt.java:678)
at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.onClientRegistered(BluetoothLeScanner.java:367)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:56)
at android.os.Binder.execTransact(Binder.java:565)

It seems that you have a problem with the app’ permissions:

  • 08-02 15:56:59.057 22373-22447/com.evothings.beaconfinder E/EstimoteSDK: SystemRequirementsHelper.checkAllPermissions:169 Your app is targeting Android M (SDK 23). You need to acquire one the location permissions: ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION

and:

  • 08-02 15:57:00.640 22373-22385/com.evothings.beaconfinder W/Binder: Binder call failed. java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results

Try putting this line on the plugin’s plugin.xml file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

i got no permission askings from the app… i think android 6 > asks automaticaly for permissions?

Hey @torbengabriel,

I added the line to the GitHub repository.
Could you please try again?

1 Like

I tried now, it works well with me:

  • go to your working directory:
    mkdir ./work_dir && cd ./work_dir,
  • clone the plug-in:
    git clone https://github.com/Lekooa/phonegap-estimotebeacons.git,
  • go to the example Cordova directory:
    cd phonegap-estimotebeacons/example/beacon-finder,
  • add the plug-ins the app’ needs:
    cordova plugin add cordova-plugin-whitelist,
    cordova plugin add https://github.com/Lekooa/phonegap-estimotebeacons.git,
  • add the Android platform:
    cordova platform add android,
  • open in AndroidStudio the file located in:
    ./work_dir/phonegap-estimotebeacons/example/beacon-finder/paltforms/android,
    AndroidStudio will ask you if it can setup the Gradle settings, accept,
  • run the project in your phone from AndroidStudio,
  • test the “Range Beacons” tab with a non-secure beacon near,
  • watch the logs of your phone with AndroidStudio.

I did exactly that, and it worked.

Permission error again…

08-03 14:16:52.582 14956-15017/com.evothings.beaconfinder D/EstimoteBeacons: The region to range: BeaconRegion{identifier=0:0:0, proximityUUID=null, major=null, minor=null, secure=false}.
08-03 14:16:52.585 14956-15017/com.evothings.beaconfinder E/EstimoteSDK: SystemRequirementsHelper.checkAllPermissions:169 Your app is targeting Android M (SDK 23). You need to acquire one the location permissions: ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION
08-03 14:16:52.585 14956-15017/com.evothings.beaconfinder D/EstimoteBeacons: Connected to BeaconService.
08-03 14:16:52.585 14956-15017/com.evothings.beaconfinder D/EstimoteBeacons: Start ranging region: 0:0:0.

i think the app should ask for permissions when you start the app… have minsdk version 16 and targetsdk version 25…

Erf…

So what should we do?
Is it possible to automatically ask for permissions?