petermetz / cordova-plugin-ibeacon

An iBeacon plugin for Phonegap / Cordova 3.x and upwards. Supports both iOS and Android (contributions are welcome)
Apache License 2.0
728 stars 372 forks source link

Beacons not scanned when the app is in background mode #433

Open an-pankajpatil opened 4 years ago

an-pankajpatil commented 4 years ago

Hello,

Seems like the beacon ranging stops when we put the app in background mode using background mode plugin. I am testing this plugin on Android and the plugin works perfectly when in foreground. In background also it works for some time, but after the screen goes blank the plugin stops ranging the beacons.

Can you please help?

prakeshcdn commented 4 years ago

I have same issue . Can you please help?

an-pankajpatil commented 4 years ago

No I didn't find any solution for this issue and it seems like Android itself is not supporting the background scanning anymore

giladrom commented 4 years ago

This plugin does not support background scanning for Android. To accomplish that, you will need to set up a background service using altbeacon.

an-pankajpatil commented 4 years ago

Hi, I tried that but once the app gets in background the scanning stops using altbeacon as well

giladrom commented 4 years ago

It works fine. You just have to set it up properly. Don't forget that android limits background scanning to 15 minute intervals.

an-pankajpatil commented 4 years ago

it doesn't work after 15 minutes

giladrom commented 4 years ago

Yes it does, you're simply not using it right. Also, some Android vendors kill off background tasks by default so you might be testing on a phone that's problematic. If you set up the reference altbeacon application it will work fine. You can check the logs using adb logcat and you'll see it wake up every 15 minutes.

an-pankajpatil commented 4 years ago

Ah! device might be an issue then but I did tried to use this SDK https://altbeacon.github.io/android-beacon-library/index.html but looks like I implemented it wronly and because of that the beacon scanning didn't worked.

prakeshcdn commented 4 years ago

Hi @pankajpatil Can you please let me know how it's working. Please help

an-pankajpatil commented 4 years ago

Hi @prakeshcdn , I am not able to setup it in the background either still trying to figure how the background scanning should be enabled.

ABRT29 commented 4 years ago

hello, I have the same behavior .. my application stops working after 2 hours

andreapozza commented 6 months ago

This plugin does not support background scanning for Android. To accomplish that, you will need to set up a background service using altbeacon.

How can I implement this solution? Must I replace these files somewhere?