Page 1 of 1

bluetooth in apk-file

Posted: 13:33, 13 Mar 2015
by brasay
Hi,

I have tested the relaxation application with the suggested cordova plugin by using the evothings workbench, and when the app is launched from the workbench it works perfectly fine.

Today I tried to package that application in an apk-file by using cordova. When I install the app it asks for the bluetooth permissions as it should, but when I run the application, it doesn't detect any of the beacons.

Any ideas why the beacons are not detected when the app is packaged in an apk file?

Thanks in advance

Re: bluetooth in apk-file

Posted: 08:43, 14 Mar 2015
by alex
Hi!

Did you add the plugin to your Cordova projekt beror buildning, using the Cordova CLI?

Code: Select all

   $ cordova plugin add https://github.com/evothings/cordova-ble.git   

Re: bluetooth in apk-file

Posted: 12:02, 14 Mar 2015
by brasay
alex wrote:Hi!

Did you add the plugin to your Cordova projekt beror buildning, using the Cordova CLI?

Code: Select all

   $ cordova plugin add https://github.com/evothings/cordova-ble.git   


Yes, I tried making the apk by also adding the plugin you said, but still nothing happens when I launch the app. I'm using cordova 4.2.0, could that be the reason that it doesn't work?

EDIT*

I downgraded my cordova version to 3.6.3-0.2.12 & installed the following plugins:

com.unarin.cordova.beacon
pl.makingwaves.estimotebeacons
com.megster.cordova.bluetoothserial
com.evothings.ble

Still no beacons get detected, how do i make them work in a standalone app?

Re: bluetooth in apk-file

Posted: 14:59, 15 Mar 2015
by micke
Hi brasay,

I will make a test and build a stand-alone app and see how it works. For iBeacon access the only plugin needed should be com.unarin.cordova.beacon.

Let me get back tomorrow or so.

Best, Mikael

Re: bluetooth in apk-file

Posted: 09:49, 16 Mar 2015
by brasay
micke wrote:Hi brasay,

I will make a test and build a stand-alone app and see how it works. For iBeacon access the only plugin needed should be com.unarin.cordova.beacon.

Let me get back tomorrow or so.

Best, Mikael


Hi,

I've tried to package the ibeacon-scan application by using cordova with the com.unarin.cordova.beacon plugin and it works perfectly in a standalone application. For some reason the relaxation app doesn't want to work in a standalone application.

Could it be that the code of the relaxation app is somewhat outdated and that would be the reason that it doesn't want to work? I would like to use the relaxation app in a standalone application to demonstrate the possibilities of iBeacons but I don't know why it doesn't want to work.

Thanks in advance.

Re: bluetooth in apk-file

Posted: 11:37, 16 Mar 2015
by brasay
Hi,

I fixed the problem. The problem was indeed the code of the relaxation app that was outdated.

I changed the following lines:

Code: Select all

var delegate = locationManager.delegate.implement(
   {
      didDetermineStateForRegion: function(pluginResult)
      {
         //console.log('didDetermineStateForRegion: ' + JSON.stringify(pluginResult))
      },

      didStartMonitoringForRegion: function(pluginResult)
      {
         //console.log('didStartMonitoringForRegion:' + JSON.stringify(pluginResult))
      },

      didRangeBeaconsInRegion: function(pluginResult)
      {
         //console.log('didRangeBeaconsInRegion: ' + JSON.stringify(pluginResult))
         app.didRangeBeaconsInRegion(pluginResult)
      }

To:

Code: Select all

var delegate = new locationManager.Delegate();
   
      delegate.didDetermineStateForRegion= function(pluginResult)
      {
         //console.log('didDetermineStateForRegion: ' + JSON.stringify(pluginResult))
      },

      delegate.didStartMonitoringForRegion= function(pluginResult)
      {
         //console.log('didStartMonitoringForRegion:' + JSON.stringify(pluginResult))
      },

      delegate.didRangeBeaconsInRegion= function(pluginResult)
      {
         //console.log('didRangeBeaconsInRegion: ' + JSON.stringify(pluginResult))
         app.didRangeBeaconsInRegion(pluginResult)
      }
   

Re: bluetooth in apk-file

Posted: 22:14, 18 Mar 2015
by micke
Glad to hear you fixed the problem! Great work finding the outdated code!

Sorry for this, I should not have old code around like that.

Best regards, Micke