Git Product home page Git Product logo

Comments (6)

andreas-becker avatar andreas-becker commented on June 12, 2024

Maybe this one might help: https://github.com/vanWezel/cordova-beacon

from cordova-plugin-ibeacon.

mrtree1 avatar mrtree1 commented on June 12, 2024

I've just added Android support in my fork. Very roughly tested and appears to work ok. It's pretty much a merge of your plugin with the Android iBeacon service from Radius Networks, which attempts to use an interface based on CoreLocation. There are no interface changes, although the nomenclature could do with being less iOS specific now e.g. callObjCRuntime.

Once I've had time to test it more thoroughly and tidy up, I'll send you a pull. I've noticed you are working on a 2.0 branch, and it should equally work ok in there without too much effort. Here's a link if you want to look in the meantime: https://github.com/mrtree1/cordova-plugin-ibeacon

from cordova-plugin-ibeacon.

petermetz avatar petermetz commented on June 12, 2024

Hi @mrtree1

Thanks for the work, this looks great.

Yeah, 1.x version is way too iOS specific and there are some other flaws in it's design too, but the 2.0 branch improves a lot on both of those (hopefully).

Peter

from cordova-plugin-ibeacon.

mrtree1 avatar mrtree1 commented on June 12, 2024

Hi Peter,

In that case I'll get the Android support working with the 2.0 branch. I should be looking at this later in the week, and then do some more testing. One thing I'm not very happy with is the ranging for some of my beacons drops out for a single cycle an then return, so the plugin might need some smoothing option.

Is it fair to assume 2.0 fairly complete, i.e. no more planned native interface changes?

from cordova-plugin-ibeacon.

mrtree1 avatar mrtree1 commented on June 12, 2024

HI Peter,

I've done the Android version of the 2.0 branch, but I have a freaky bug on iOS. Everything works except the delegate callback never receives anything after it's configured (the OK from the callback being set does fire). The debug is showing monitoring and ranging is working fine, but nothing ever reaches the JavaScript. Exactly the same test code is working fine on Android, and the registerDelegateCallbackId clearly keeps the callback alive, so I'm a bit stumped. Does this work for you at all? I'm just wondering if keeping the callbackId is enough? I use the original CallbackContext on Android for the same purpose, not just the Id.

BTW if you want to pull the code from by 2.0 branch it's now pretty much ready. I've made only a tiny change to the iOS version and Javascript to support Ranging as well as monitoring, and otherwise it's just config and Android code. I've attempted to map the iOS code function for function into Android where appropriate, so it should be fairly readable.

There are two differences between the code:

  1. Android doesn't support CircularRegions. That's just a limitation of the library I used to give iBeacon functionality and could be added at a later date I guess.
  2. I've added extra events (which are in the iOS LocationManager) for user authorization, and some failure events. I was reluctant to add to iOS in case you were working on them or didn't want them. They don't seem urgent, and I've not exposed them with defaults on the delegate class except for ranging.

Cheers

Tree

from cordova-plugin-ibeacon.

petermetz avatar petermetz commented on June 12, 2024

Hi @mrtree1

I tested the code after merging in your changes and the delegate callbacks are working fine for me on iOS. Are you sure you called the setDelegate method on the LocationManager, passing in your custom delegate object? Sorry if it's a silly assumption, but at the moment I don't have any better ideas why it would not work for you.

I'll have a look at the authorisation methods you were mentioning, just a little more time... :)

Closing the issue as android support is now added to the plugin's arsenal, huge thanks for @mrtree1 for the complete implementation and the extra work merging it into the v2 branch as well!

Peter

from cordova-plugin-ibeacon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.