Proximity background service ios & android

Ask, and ye shall receive.
arickatz
Posts: 22
Joined: 09:51, 11 Jan 2015

Proximity background service ios & android

Postby arickatz » 10:01, 11 Jan 2015

Hi All,
I need to accomplish a proximity background service that will support IOS and Android that
will send a notification with wake lock permissions (clicking the notification will open an app) when
proximity / range is above and below a pre-defined level in pre-defined days, like not on weekends.
Is this something that can be done with the evothings environment?
Is there a free app in the app store / google play that can do that?
I achieved something similar on android using the smart connect app combined with notify me
that would send a notification and launch an app when regular BT would connect and disconnect.
I currently did some development using phoengap build and I have a fully working app that requires this service to start it that runs on
both platforms.
Thanks in advance, Aric.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Proximity background service ios & android

Postby micke » 16:36, 12 Jan 2015

Hi, here is a guide for doing background notifications when monitoring beacons:

https://github.com/evothings/phonegap-e ... tion-guide

The context is the Estimote Beacon Cordova plugin, but it should work with any iBeacon plugin.

Perhaps the above can be of some help for you?

Best regards, Mikael

arickatz
Posts: 22
Joined: 09:51, 11 Jan 2015

Re: Proximity background service ios & android

Postby arickatz » 18:05, 12 Jan 2015

Thanks, This might be exactly what I need.
I will check it out with phonegap build and update on my results.

P.S.
do you know of less expensive beacons (around 10$, I am currently using estimote) that work well, can last 3 years and more
and also can be referenced with the phonegap code?
I am looking to buy, for a new company I am building, quantities that can range from hundreds to a couple of thousands.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Proximity background service ios & android

Postby micke » 18:51, 12 Jan 2015

Sounds like a great project you have!

I will ask my colleagues about options for cheap long-lasting beacons.

Meanwhile here is a year-old guide that is probably outdated by now:

http://beekn.net/guide-to-ibeacons/

Here is a list of beacons from various manufactures:

http://www.alibaba.com/trade/search?fsb ... xt=ibeacon

You should be able to use any beacon hardware that implements the iBeacon protocol with a Cordova iBeacon plugin (like the one by Peter Metz or some other iBeacon Cordova/Phonegap plugin).

Best regards, Mikael

arickatz
Posts: 22
Joined: 09:51, 11 Jan 2015

Re: Proximity background service ios & android

Postby arickatz » 19:59, 12 Jan 2015

Thanks again,
I took a brief look on the plugin link, there a couple of things that appear unclear.
I worked with local notification plugin in the past, yet:
1. there is no reference for the actual code used to test this.
2. which plugin is responsible for the background sampling of the range /distance.
3. What is the sampling ratio = every 1,2,5 seconds?
4. How does this affect the phone's battery?
5. It says that on IOS ranging is not supported in background mode, can you move the app to the foreground when beacon is detected?
alternatively, can you limit the beacon to be detected only from a short distance like 1 meter?
6. What is the reliability of this solution? will there be any missed detection or false alarms?

Thanks in advance, Aric.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Proximity background service ios & android

Postby micke » 20:55, 12 Jan 2015

Hi again, here are some answers:

1. there is no reference for the actual code used to test this.

I did the tests by adding the code snippets in the guide to this file:

https://github.com/evothings/phonegap-e ... /js/app.js

Also added the notification plugin to the Cordova project.

I don't have a ready-made example for this at hand. This is on the to-do list however.

2. which plugin is responsible for the background sampling of the range /distance.

Here is the notification plugin I used:

https://github.com/divineprog/cordova-p ... ngs-master

3. What is the sampling ratio = every 1,2,5 seconds?

That depends of the beacons and whether ranging or monitoring is used. Ranging is much faster, but cannot be used in the background.

4. How does this affect the phone's battery?

I don't know really. Perhaps monitoring consumes less battery than ranging.

5. It says that on IOS ranging is not supported in background mode, can you move the app to the foreground when beacon is detected?
alternatively, can you limit the beacon to be detected only from a short distance like 1 meter?


Monitoring is the only iBeacon mode supported in the background on iOS. You do not get proximity information when monitoring. Here is a blog post that may be of interest with some further details:

http://evothings.com/quick-guide-to-wri ... avascript/

6. What is the reliability of this solution? will there be any missed detection or false alarms?

This is very hard to say! This technology is new and I have not seen any large scale tests yet.

You could approach Estimote with your questions to hear their view. You could also ask for bulk prices and if beacons can be configured to increase battery life to three years. In my experience Estimote has solid knowledge about beacon technology.

Regarding the really cheap beacon you can find at Alibaba, the quality of these devices are unknown and probably very varying. An idea is to order a few samples to try them out.

Best regards, Mikael

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Proximity background service ios & android

Postby micke » 17:30, 13 Jan 2015

Hi Aric,

I have been thinking about ranging in the background. This should work on Android, since there are less limitation than on iOS.

On iOS, it seems you can do CoreBluetooth scanning in the background:

https://developer.apple.com/library/ios ... round.html

CoreBluetooth scanning is as fast as ranging (updates every second or so) and you get the RSSI value to calculate proximity/distance.

This could be a way to achieve something similar to ranging, while in the background. Apple's CoreLocation API (which is the iBeacon API on iOS) will not allow ranging in the background, and the CoreBluetooth API does not deliver the data used to identify iBeacons, so it is a bit complex of a situation. The workaround is to use some other beacon protocol that includes the beacon id in the advertisement data, which is available when doing CoreBluetooth scanning.

I believe Estimote is using this technique for their new Estimote Stickers. Stickers use a new API called "Nearables", that has a different way of identifying beacons than the iBeacon way. So it should be possible to do beacon ranging in the background. I do not know however if other beacon vendors are working on similar techniques, or if it would be feasible to order beacons configured in a way to work with CoreBluetooth scanning. In any way standard Cordova iBeacon plugins would not work, a new plugin is needed in this case.

Some info about Estimote Stickers:

https://community.estimote.com/hc/en-us ... /203323543

https://community.estimote.com/hc/en-us ... -stickers-

Regards, Mikael

arickatz
Posts: 22
Joined: 09:51, 11 Jan 2015

Re: Proximity background service ios & android

Postby arickatz » 17:49, 13 Jan 2015

Thanks for the additional info.
I took your advice and also approached estimote
And they also told me that i can configure the beacon
To low power and then it will reveal itself from a
distance of 1 - 2 meters which will be goo enough
For because i need to dend a notification to the users
Phone when he is in low proximity, when teaching
The zone and living the zone, i hope there i will not teceive false alarms of disconnection while in range

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Proximity background service ios & android

Postby micke » 18:16, 13 Jan 2015

Hi Aric, many thanks for the update.

Sounds like a good method to lower the power to make beacons visible in shorter range.

Did some more research on iOS background BLE scanning, and there seems to be some restrictions, so I am not that sure the approach I outlined above will work as expected.

Regards, Mikael

arickatz
Posts: 22
Joined: 09:51, 11 Jan 2015

Re: Proximity background service ios & android

Postby arickatz » 19:33, 13 Jan 2015

I will update this post, after I will finish playing around with the platform and hardware configurations
and reach some interesting insights.


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 55 guests