alann-maulana / flutter_beacon

An hybrid iBeacon scanner and transmitter SDK for Flutter Android and iOS.
Apache License 2.0
117 stars 144 forks source link

Ranging/monitoring a beacon when app was terminated #22

Closed mahmuttaskiran closed 4 years ago

mahmuttaskiran commented 4 years ago

Is it possible to monitor or rang a beacon when app work in background or terminated by the os? I can get monitoring events and ranging events when app is in foreground with this plugin. I tried to show a local notification for a right condition of beacons on background, but I could not.

flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G95, locale en-TR) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 10.3) [✓] Android Studio (version 3.4) [✓] IntelliJ IDEA Ultimate Edition (version 2019.1.4) [✓] VS Code (version 1.38.1) [✓] Connected device (1 available) No issues found!

Device

SM N950F • ce08171822449e08057e • android-arm64 • Android 9 (API 28)

alann-maulana commented 4 years ago

Hi @mahmuttaskiran

Maybe this will work for you AltBeacon/android-beacon-library#Android O ranging in background issue. But this behavior (ranging beacons in background) will not work on iOS.

Yup, feel free to send PR 😄

modernecotech commented 4 years ago

Could you please post a short example of beacon monitoring when app is not running?

mahmuttaskiran commented 4 years ago

Thanks, @alann-maulana. I have written a plugin for ranging and monitoring in the background for Android. On iOS I don't know if it is possible or not, I am not an expert on iOS. I have read some articles for possible iOS implementation but as far as I know, there are some restrictions for background execution especially for ranging.

modernecotech commented 4 years ago

is it possible to have beacon monitoring in background, and when a beacon is detected for the app to start in background to do some work (maybe send a notification or whatever). Right now it only works for me when the app is either in foreground or background... but not if the app is not started by user.

alann-maulana commented 4 years ago

Could you please post a short example of beacon monitoring when app is not running?

I use this library daily at all of my office projects. You can use the monitoring beacon method both for background and foreground mode.

alann-maulana commented 4 years ago

Thanks, @alann-maulana. I have written a plugin for ranging and monitoring in the background for Android. On iOS I don't know if it is possible or not, I am not an expert on iOS. I have read some articles for possible iOS implementation but as far as I know, there are some restrictions for background execution especially for ranging.

Nice @mahmuttaskiran

I have some workaround too for enabling foreground ranging beacons on Android. But as far as I know, in iOS you can only extend it for maximum 3 minutes ranging in background. Here is nice article from David G. Young from RadiusNetworks Extending Background Ranging on iOS.

I using these technique too BTW :)

alann-maulana commented 4 years ago

is it possible to have beacon monitoring in background, and when a beacon is detected for the app to start in background to do some work (maybe send a notification or whatever). Right now it only works for me when the app is either in foreground or background... but not if the app is not started by user.

In Android you can extend your Flutter Application Class using these method Detecting Beacons After App is Killed. But, as you know there is always a limitation for iOS 😅