-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beacons.startMonitoring is crashing the app #13
Comments
Well, finally i made it work x). Firstly, this error is generated because region.initFrameworkValue() is not called anywhere through the startMonitoring() methods. After this, i was getting some errors due to the results expected, so i changed the logic a bit. At Channels.kt, change the startMonitoring() method that containts
to
At channels.dart, change startMonitoring() method return statement to: (returns nothing) After doing this, the new beacon is being monitored withouth any errors. But this doesn't here. This plugin separates the control of monitoring between the listener of Beacons.monitoring() event and Beacons.backgroundMonitoringEvents(). I think this is just usefull when u want to have different beacon monitoring depending on the inBackground attribute. But if u want to manage all beacons in the same listener (that listens the events when the app is in foreground and active) you must do one thing. In SharedMonitor.kt you must set in attachForegroundNotifier() method: Hope Helped SomeOne! |
I'll make this a pull request because everytime I want to update my packages especially in other 3rd party packages, the beacon package gets updated. Steps:
I'm not familiar with the kotlin syntax, so I'll have to test it out.
in startMonitoring() method, it returns a Future of BeaconResult, changing to void will return nothing, I don't know what will happen to the response variable because I haven't tested it yet with this plugin |
U can't exactly know the distance of the beacon. There is field that seems to give this value but i have tested it and sometimes this value is not good. Trust in the rssi. Thank you for contributing into this. |
The hardware I am using supports distance, but it's not really accurate as it fluctuates every second. Just do PR if you fixed something. There are tutorials on how to do PR(depends on what project you are to.) some are strict with CI enabled. |
When I try to use the method Beacons.startMonitoring withouth starting a .monitor listener or stream (but set the backgroundMonitoringEvents method), the app crashes with the following error.
I/flutter (30714): beacons: invoke beacons->startMonitoring {"region":{"identifier":"test","ids":["b65de587b6494010af5bb6a733fc8ddd"],"bluetoothAddress":null},"permission":"coarse","inBackground":true}
D/beacons client(30714): start Monitoring (inBackground:true) for region: test
I/zygote64(30714): Do partial code cache collection, code=118KB, data=70KB
I/zygote64(30714): After code cache collection, code=118KB, data=70KB
I/zygote64(30714): Increasing code cache capacity to 512KB
E/AndroidRuntime(30714): FATAL EXCEPTION: main
E/AndroidRuntime(30714): Process: com.anxaneta.motobeacon, PID: 30714
E/AndroidRuntime(30714): kotlin.KotlinNullPointerException
E/AndroidRuntime(30714): at io.intheloup.beacons.data.RegionModel.getFrameworkValue(RegionModel.kt:17)
E/AndroidRuntime(30714): at io.intheloup.beacons.logic.SharedMonitor.start(SharedMonitor.kt:58)
E/AndroidRuntime(30714): at io.intheloup.beacons.logic.BeaconsClient.startRequest(BeaconsClient.kt:188)
E/AndroidRuntime(30714): at io.intheloup.beacons.logic.BeaconsClient.startMonitoring(BeaconsClient.kt:146)
E/AndroidRuntime(30714): at io.intheloup.beacons.channel.Channels$startMonitoring$1.doResume(Channels.kt:65)
E/AndroidRuntime(30714): at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:42)
E/AndroidRuntime(30714): at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:161)
E/AndroidRuntime(30714): at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:25)
E/AndroidRuntime(30714): at android.os.Handler.handleCallback(Handler.java:790)
E/AndroidRuntime(30714): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(30714): at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime(30714): at android.app.ActivityThread.main(ActivityThread.java:6499)
E/AndroidRuntime(30714): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(30714): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
E/AndroidRuntime(30714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I/Process (30714): Sending signal. PID: 30714 SIG: 9
Lost connection to device.
The text was updated successfully, but these errors were encountered: