Closed anulman closed 9 years ago
Appreciate the prompt response Piotr. Strange that I only see it in email, not in this thread—the email even links here!
I actually upgraded the bundled SDK when init'ing the fork 4 days ago, extracting + renaming the jar from this repo's aar.
[just saw c5e847f62b7f451b6770ec888259b38d0af00a5c]
i can haz auth! :+1:
Great! :tada: :smiley:
(Can't see my reply too, not sure what happened.)
TL;DR: If this issue sounds familiar, ensure you've bundled SDK 0.6.1+
beaconConnection.authenticate()
times out when attempting to establish aBeaconConnection
in a Cordova plugin.I've tried to establish a connection to a beacon using the Estimote Android app, the Estiimote Android-SDK Demo app, and a Cordova-wrapped app using a fork of the Evothings plugin I've been extending.
The Cordova plugin implementation exclusively throws errors: there was a 503 once; otherwise it's been consistently timeouts.
Both the Estimote app and the Estimote Demo app are able to connect to beacons as expected, which seems to rule out private behaviour & shared antenna issues some Android devices reportedly experience.
I suspect there is an incompatible jar in play, though may also have missed Occam's Razor while debugging.
Should I keep hunting, or does this look internal?
Will share details, in case they're of use:
BeaconConnection
constructor params work as intended:context
is the same one registered on theBeaconManager
, which handles ranging events as expected;beacon
matches the Estimote Demo app's object type && source (caches and passes a rangedBeacon
vs instantiating a new one from params), and the same beacons were tested with all three apps (same macAddress, proximityUUID, major, and minor), including one on firmware A2.1 & one on A3.0.1;BeaconConnection.ConnectionCallback
, although implemented as a PluginConnectingListener class (EvoThings convention) vs. a method (like the Estimote Demo app), is getting called (see stacktrace, below) and was also tested with the same strategies [as the docs](#todo source) and demo app.After printing and reviewing the stacktrace, I thought OkHTTP was the issue (spoiler: inconclusive). Turns out Cordova used to include a copy of OkHTTP its builds; this default was only recently removed.
I've since updated to Cordova v5.0.0, incl a recent cordova-android build (i.e. without embedded OkHTTP), and Android API level 22 / the latest SDK tools + build tools. Now, neither
onAuthenticated
noronAuthenticationError
methods are getting triggered after callingmBeaconConnection.authenticate()
(also tested by replacing the constructor'sbeacon
withbeacon.getMacAddress().concat("foo")
). Ranging continues to function.I've also tried with & without pausing ranging / monitoring events (also w/ & w/o disconnecting the
BeaconManager
). Tried commenting this out in the Demo App'sListBeaconsActivity#onStop
as well and it did not affect results, so was not expecting much :)I hope this report doesn't come off negatively. I've enjoyed hacking with Estimotes for some time now, and appreciate how the SDK + APIs have evolved with the product. Sending a big :+1: to the team!