Closed Draptol closed 5 years ago
This is very confusing to follow because the library has its own service names BeaconService, which has the same name as your custom service. I cannot tell what lines come from what.
A few points:
The RegionBootstrap class is designed to be used from an Application class. If you cannot use it from there, you should really define your service to be a BeaconConsumer, call beaconManager bind(this)
in your service startup, then start monitoring your regions in the onBeaconServuceConnect
callback. This is how the library is designed to be used in cases like this. RegionBootstrap us just a helper class for use in Application.
Consider that in Android 8+ you can no longer have long running services unless they are foreground services, so if you ever need your app to run beyond Android 7, this architecture could be a problem.
If you want to press on as-is, you are welcome to do so, but you may run into problems by using RegionBootstrap in a way that is not intended or instructed. I see nothing in the logs that shows RegionBootstrap was constructed after your service restarted. (RegionBootstrap should log debug lines that are for some reason not visible.) You might add your own logging when it is constructed to ensure it is.
This is most certainly an issue with custom app debugging, not a bug in the library (even if there is some kind of underlying bug it is triggered by use of RegionBootstrap in a way the docs say not to use it.) That makes this issue out of scope for this forum. I am happy to help further if you'd like to open a question in StackOverflow.com, but I am closing this issue here to keep this forum dedicated to known library bugs and feature requests.
Hi, I have a problem (or a Bug) with your library. I am preparing a small library in which one module scanns beacons in background and foreground. I found your sample app on Github and I tested your code (application class) and everything is ok. After user goes to the task switcher and swipes an app off the screen, scanning is being continued in background.
This is my Application class:
and I am getting these logs in logcat:
But I am creating a library so I can't paste my code inside Application class. Insted of this I need to do something like this
MyLibrary.init(this)
inside onCreate method in ApplicationClass. So I wrote aBeaconService class
with exactly the same code like in application class. I passed to this classapplication context
(I checked that I have inside myBeaconService
application context by debugging my code). After that when app isn't killed by swapping off from task switcher evrything works perfect. After killing the app I got exit from region event and I am not able to continue scanning even if the beacon is about 20 cm far from device.This is my BeaconService class
and I am getting these logs in logcat:
You can see in above logs that after killing the app the logs are exactly the same as while using Application class instead of BeaconService class. There is only one little problem that I got event "Exit region: id1: null id2: null id3: null" .
Could you tell me what I am doing wrong or maybe is this a bug ?
Android 7.0 Device: Lg G5