Skip to content
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

Determine what bluetooth signals vehicles give off and how they can be read while in the foreground and background #1046

Open
shankari opened this issue Feb 1, 2024 · 37 comments

Comments

@shankari
Copy link
Contributor

shankari commented Feb 1, 2024

  • Find a sample bluetooth app that displays readings on the screen and also logs them
  • Install it on the test phones (compiling if necessary) and walk around and see which signals are present while running in both in the foreground and the background
    • I expect that iOS will show bluetooth signatures in the foreground but not in the background
    • I also expect that if we can put in the bluetooth signal that we find in the foreground into the scan message, it will work in the background as well (this we may have to write/modify code for)
  • Once we have preliminary results, we should write up a test plan and collect rigorous data for a paper later
  • Then we should decide how to proceed
@the-bay-kay
Copy link

the-bay-kay commented Feb 2, 2024

Initial Findings

I've been diving head first into Bluetooth research; here's some notes and thoughts on what I've found so far!

A Note on Key Fobs

  • Smart key fobs (the kind you can leave in your pocket) seem to operate at around 300Mhz - 8000 Mhz, towards the lower end of the Industrial, Scientific, & Medical (ISM) radio band (visualization here!), which is a significantly lower than Bluetooth's operating frequency of around 2.4 Ghz (link), so I don't think we could use them as a beacon.
    • Once we get access to the GACA, I'll do a deep dive into what types of Bluetooth we'll have access to; my guess is, the on-board stereo will be the most readily available.

Bluetooth v.s. Bluetooth Low-Energy (BLE)

  • If anyone else is interested, I found this article to be really helpful when it comes to understanding the broad-stroke differences between Bluetooth and BLE.
  • In my research, I stumbled across this Cordova BLE plugin that seems like exactly what we'd need! If standard Bluetooth doesn't pan out, this seems like a great plug-and-play backup. Honestly, pretty excited to find a well-maintained plugin that would handle this for us.
  • I do worry somewhat about the reliability of standard Bluetooth. Since it exists in a binary state (whereas BLE can "hibernate"), I think there's a non-zero chance that a "stereo beacon" may not be transmitting for the entire duration of a trip; since we couldn't "wake" the stereo from the phone, we'd need the user to constantly have Bluetooth enabled.
    • Why I'm concerned: some stereos, like the ones I've worked with, have different media modes -- in order to access Bluetooth, you have to manually change the stereo to that setting. My hypothesis is, the stereo is not broadcasting unless it's set to Bluetooth. A consequence of this would be that, if I wanted to listen to the radio for my commute, my trip wouldn't register. Once I've got a Bluetooth meter app installed (see below!), I'll go out to my car and do some tests.
    • There's also a conversation to be had about battery consumption, but we'd have to test the difference in battery drain between Bluetooth receiver protocols -- there's for sure a difference when transmitting, but I can't find any conclusive evidence on the receiver behavior.

Sample Bluetooth Meter Apps

  • From what I can tell, there's pretty slim pickings for apps that are: (a) Open Source, (b) Cross-Platform, and (c) Actively maintained.
    • I personally thing (a) and (c) are the highest priority -- It'd be nice to see a Cordova-esq (Flutter, React-Native, etc.) implementation of standard Bluetooth, but I think having up-to-date code examples is more important.
    • There seem to be a ton of desktop Bluetooth scanners, if we just want to see protocols and device availability. I won't include them here, but there are plenty of options I've jotted down! Some of these software suites are used for pen testing, so we'd want to tread carefully...
  • Below is a quick table containing the Mobile App options I've found so far!
App Name Link Last Updated iOS Android Bluetooth BLE Open Source
OpenBLE link 11 Years Ago
Bluetooth Scanner link 7 Years Ago
BleCORE† link Today!
BlueSniff link 2 Years Ago ?
Bluetooth Finder, Scanner Pair link This Year! ?
Simple Bluetooth Scanner link Two Years Ago ?

†The docs for BleCORE are in Mandarin -- from what I can gather, their demo app does what we want to test (just in Kotlin). If we want to look into this further, I've got a friend that could help me read through the docs!

Final Notes

I'll keep adding to the table above as I find more example apps -- if anyone's familiar with some, please let me know! As the table shows, there doesn't seem to be a "one-size fits all" example project that we could use as a code reference. I may start with a desktop BLE scanner on my personal computer, just to test my stereo-broadcast hypothesis -- once I've got more data, I'll make another post on this thread!

@shankari
Copy link
Contributor Author

shankari commented Feb 2, 2024

Couple of high-level thoughts:

In my research, I stumbled across this Cordova BLE plugin that seems like exactly what we'd need! If standard Bluetooth doesn't pan out, this seems like a great plug-and-play backup. Honestly, pretty excited to find a well-maintained plugin that would handle this for us.

Yes, cordova has plugins for lots of things - some cordova app developers have never written native code - only javascript, and will not implement functionality if they have to drop down to native. We can definitely reuse code from it, but I don't think we will want to use it as a plugin directly because plugins are intended to be called from javascript, and we want to call the bluetooth from the FSM that is implemented in native code

@the-bay-kay
Copy link

Making a Bluetooth Test Scanner

Just putting some initial thoughts on the project here!

The goal is to make a very simiple app that allows us to see a list of all currently broadcasting Bluetooth devices within capture distance. Since our research revealed that there isn't a "one-size fits all" app, the plan is to make a simple one ourselves. Admittedly, we could use a selection of the apps detailed above, but I think this will be a helpful learning exercise!

I'm thinking we make this app in React + Cordova, since it's what we're already using.

Task Brainstorm

  • Set up repository for the project, link here / elsewhere
  • Figure out how to prompt the user for Bluetooth Permissions (I believe this is a req)
  • I believe we can use this plugin for our Bluetooth API. We'll obviously need to write our own native code later, but this will suffice for the test app
  • For the code, some requirements may be:
    • A react component to store device data (e.g., OID, signal strength, type (BLE / Classic) ).
      • Each component could render as "Device Name + Type", and use OID if no name is available
    • A JS method that performs a scan, and returns a list of objects with the device data listed above
    • Find a method to "refresh" the list; either via a manual refresh,
    • A page that contains a scrolling list of the Device Components (propagated via the "scan()" method)
  • Write up / finish documentation on building to hardware
  • Write a brief tutorial on how to use the app and record results
  • Send off to the team for testing!

What's Next

Louis and I are meeting tomorrow to discuss these rough plans -- we'll find a way to divvy up the task, and update this thread with our progress!

@shankari
Copy link
Contributor Author

shankari commented Feb 8, 2024

@the-bay-kay @louisg1337 I wanted to suggest that instead of building a new app and setting up the toolchain all over again, you can just change the existing app. My suggestion would be:

  • add the bluetooth plugin to e-mission-phone by simply changing the package.json
  • create a new screen to display bluetooth values and log them to the database
  • make the screen conditional on a config flag
  • set the config flag to true on the GSA config and only the GSA config

That way, when people install the "GSA configured" app on their test phones, they can also test out the bluetooth without having to recompile.

Thoughts?

@the-bay-kay
Copy link

the-bay-kay commented Feb 8, 2024

@the-bay-kay @louisg1337 I wanted to suggest that instead of building a new app and setting up the toolchain all over again, you can just change the existing app...

I think this is a great idea!! I spent some time chatting with Louis yesterday about designing an app from the ground up, but having the scanner hidden under the dev options would be far easier to implement. Plus, it'd make the distribution of the scanner way easier -- we'll pivot to making it an addition!

the-bay-kay added a commit to the-bay-kay/e-mission-phone that referenced this issue Feb 9, 2024
See Issue [e-mission#1046](e-mission/e-mission-docs#1046 (comment))
for more details.  This commit adds the Dev-Zone settings option, which
will eventually link to the Bluetooth Scanner page.

TODO:
- Add i18next translation for control.bluetooth
@the-bay-kay
Copy link

the-bay-kay commented Feb 16, 2024

Update on Plugin Search

When working on PR 1128, we've looked into a few other Bluetooth plugins and resources. Below is an updated table, along with some additional notes / resources.

Most notably, Louis found a fork of the Bluetooth Serial Plugin that theoretically supports iOS Bluetooth scanning. There are, however, a few caveats:

iOS applications need additional configuration to allow Bluetooth to run in the background.

According to these docs, it appears that iOS devices cannot scan for unrecognized Bluetooth devices in the background. I believe this means that we will be able to scan in the foreground, but I need to do further reading on the iOS Bluetooth docs (link) to determine how viable this approach is.

As of writing, we are using the original plugin (link) in PR 1128 . I'll update this thread further when we test the fork that enables iOS bluetooth classic scanning!

Bluetooth Scanning Plugins

App Name Link Last Updated iOS Android Bluetooth BLE Open Source
OpenBLE link 11 Years Ago
Bluetooth Scanner link 7 Years Ago
BleCORE link Today!
BlueSniff link 2 Years Ago ?
Bluetooth Finder, Scanner Pair link This Year! ?
Simple Bluetooth Scanner link 2 Years Ago ?
Bluetooth Serial link 6 Years Ago * *
Bluetooth Serial Fork link 3 Months Ago *

@louisg1337
Copy link

louisg1337 commented Feb 16, 2024

BLE Beacon Candidates

Below is a list of different BLE beacons that we can use for this project.

  • Accent Systems iBKS 105
    These beacons are @the-bay-kay certified as she saw these beacons being used in a project by the DOT in Buffalo. They check all the regulatory boxes we must meet for BLE beacons, and are relatively cheap <$20 per unit. We have ordered 5 already and this so far is our best choice.

  • Zebra Technology MB1000 Beacon
    This company was recommended by a colleague in NREL as they are based and manufacture in the U.S. They have unfortunately not gotten back to me after ~2 weeks, so although promising, may not be a viable choice.

  • Estimote Beacons
    The intended use case for these beacons is for spatial awareness, so they may be a bit too overkill for our application. They are advertised as UWB beacons, but have BLE compatibility as well. The beacons come with a custom SDK that seems like it makes the usage of the beacons super easy (its behind a paywall though so can't confirm). They also have these cool BLE stickers, but they only have a battery life of 6-12 months and the batteries are not replaceable (super sad). I am currently in contact with them though to see if their former product is viable for our needs.

    • UPDATE: I spoke with the CEO of Estimote and got some more information. They have a beacon designed specifically for cars that 1) look cool and 2) are more sleek than other beacons. The beacons themselves are both BLE and UWB enabled, and even though we only need BLE, having that UWB capability is pretty cool. It's important to note though that UWB is only available on Android 14+ devices and iPhone 11+. They also have their own SDK that we can use to potentially make the development process easier. In terms of logistics, the beacons are manufactured in NATO countries in Europe and are around $20-$30 depending on the quantity we are buying.
  • Willot IoT Pixels
    These BLE beacons are super cool, but also seem a bit overkill. They are sticker sized beacons that harvest nearby RF waves for energy, so they don't need batteries. There are a bunch of integrated sensors within these beacons that can detect location, humidity, and temperature. The only issue with these is that they also sell their own cloud management system for these beacons, which may be the only way to communicate with them. Since we only need to sense the BLE signal, this may not be an issue for us. I am also in contact with them right now to discuss if their product can work for us.

    • UPDATE: These beacons look like they are not going to work out unfortunately. The RF harvesting technology isn't as magical as we thought, as you need a bridge that emits RF waves to power the pixel. Needing a big energizer defeats the purpose of why we liked the pixel in the first place, being that it was a small sticker. Willot also said they were looking to roll out their product to customers with a 1M+ unit case, which isn't feasible for our project.

I'll add more to the list once I get more information from each company, and if I find any other good candidates.

@shankari
Copy link
Contributor Author

shankari commented Mar 4, 2024

Current decision:

  1. we will check in the changes so far and merge them since they are isolated to the dev zone
  2. we will pivot to BLE and write a very similar scanner
  3. we will work on the FSM
  4. return to Bluetooth classic if we have time

@shankari
Copy link
Contributor Author

shankari commented Mar 4, 2024

For the FSM changes, I think we can handle it in two approaches, and we may even need both to be safe.

  1. Keep the existing geofence exit but when we get the EXITED_GEOFENCE event, check fleet deployment or not. If fleet, scan to see if a known bluetooth is nearby and only start tracking in that case. TBD: record the bluetooth scan that we saw so we can map the trip to the vehicle during post-processing
  2. Register for iBeacon enter/exit and if we get an enter with a known bluetooth, then:
    a. start tracking location
    b. check to see that there has been sufficient duration or distance or something from previous trip end and then start tracking location

Implement (2a), check power and accuracy, decide whether we need the complexity of (2b)

Both of the above are for trip start which is the crucial part because we should not be tracking non-fleet trips, that is our promise. But we should document how to handle trip end for the record.

  1. Keep the existing dwell time trip end algorithm
  2. When we exit the iBeacon range, end the trip

@the-bay-kay
Copy link

the-bay-kay commented Mar 6, 2024

Plugin updates!

@louisg1337 did some digging on our preexisting list of plugins, and found that the cordova-plugin-ble-central seems to be (i) the most popular BLE plugin, and (ii) the most frequently forked plugin. Within this plugin, however, they have a note:

This plugin isn't intended for scanning beacons. Try cordova-plugin-ibeacon for iBeacons.

Following their suggestions, we're looking to add this plugin in our second iteration of the developer Bluetooth scanner!

@shankari
Copy link
Contributor Author

FYI, that cordova plugin seems to add the COARSE_LOCATION_PERMISSION, although we already have the FINE_LOCATION permission defined. This means that I can't publish this release until I provide justification for the COARSE location permission.

Screenshot 2024-03-26 at 10 14 01 PM

@shankari
Copy link
Contributor Author

shankari commented Mar 27, 2024

In the long term, we will hopefully not need this permission since we will not be using the plugin. I'm going to try to remove the COARSE permission (we already have FINE) and then rebuild just so I don't add a new, spurious permission that I don't know how to remove when it is no longer necessary.

@the-bay-kay
Copy link

the-bay-kay commented Apr 15, 2024

BLE FLEET Testing

These tests are focused on testing the changes implemented within this branch of the e-mission-data-collection repository.

Testing Procedure

Testing procedure will closely follow the simulated tests done by @shankari in PR 1144, but performed with actual beacons. The following will be my testing procedure:

Test Setup

  • Clone the latest version of e-mission-phone, operating on master
  • Clone the latest version of e-mission-data-collection, switching the integrate_ble branch
  • Setup e-mission-phone as follows, without building:
    • For iOS:
        bash setup/setup_serve.sh; source setup/activate_serve.sh; npm run serve; bash setup/setup_ios_native.sh;
    • For Android
      bash setup/setup_serve.sh; source setup/activate_serve.sh; npm run serve; bash setup/setup_android_native.sh;
  • Once the e-mission-phone repository is set up, I will replace the existing version of em-data-collection with integrated_ble
    cordova plugin remove cordova-plugin-em-datacollection;
    cordova plugin add ~/Path/To/e-mission-data-collection/; # This repo will be set to `integrate_ble`
  • Finally, I will finish building either as follows:
    • For iOS, I will build basically as described within this thread.
    • For Android, I will run source setup/activate_native; npm run build-dev-android, then copy the resulting .apk via adb.

Beacon Setup & Usage.

For tests involving the FLEET deployments of OpenPATH, I will be testing with a BLE Beacon.

  • The beacon is configured to -20db, or roughly a ~5m range, similar to live deployment settings.
  • For each test, I will perform the following for the given OS:
    • For iOS:
      • The test phone will be placed outside of the beacon's range before trip simulation.
      • I will then bring the beacon to the phone (when necessary, as described below), and then, after waiting ~60 seconds, move the beacon out of range. This is to simulate the entrance and exit of a beacon region.
    • For Android
      • The test phone will be placed inside of the beacon's range before testing.
      • During testing, the beacon will be moved out of range, to simulate an exit.

Test Procedure

  • Launch the build described above, using either XCode or adb logcat to view the Native logs.
  • Log in via either a fleet-code, or a non-fleet code (recording which)
  • Navigate to the developer settings, and using the Force State Dev Tool, simulate a trip as follows:
    • Simulate a Geofence exit via VISIT_END
    • Depending on the Config version, I will perform the following:
      • For FLEET: I will simulate a BLE REGION entrance and exit, as described above. Within the logs, we should see that OpenPATH will begin tracking upon BLE Enter, and stop tracking upon BLE Exit.
      • For Non-FLEET: I will wait ~90 seconds, approximately the same amount of time as it takes to perform the BLE Tests. We should see tracking begin as soon as the VISIT_END occurs, and end with VISIT_START
  • Force a Location-Based end detection via VISIT_START.

Goals for Data Collection:

As described above, we are looking to analyze the the behavior of the trip tracking. I will provide the relevant segment of logs with each trip, and provide testing notes on the logs.

With these test guides in mind, my first test will be with a 2022 iPhone SE, and I will report them within this thread. My additional tests will be performed on an iPhone 8, LGv30, and Nexus 6.

Testing Setup Photos:

Repository Set Up

image

(TODO: Link to relevant PRs for documentation's sake)

@shankari
Copy link
Contributor Author

Simulate a Geofence exit via VISIT_START
Force a Location-Based end detection via VISIT_END.

This is flipped. A visit is time spent at a place. So visit start = trip end and vice versa

I will then bring the beacon to the phone (when necessary, as described below), and then, after waiting ~60 seconds, move the beacon out of range. This is to simulate the entrance and exit of a beacon region.

This will work for iOS only. For android, @louisg1337 has set up the code so that the geofence is still primary, and only after the geofence exit, we start ranging to find the beacon. So on android, you will need to start a trip (using "Start trip") and then move the beacon near/far. Also, on android, the trip end is still based on the location based trip end, so geofence based exit is not meaningful.

Log in via either a fleet-code, or a non-fleet code (recording which)

I am not sure you can log in naively via fleet code - @JGreenlee's PR turning on the fleet tracking is still in draft and has not been merged. You will need to use a local server that is serving up configs. If you have not done this before, this is non-trivial. @JGreenlee, can I merge the PR so that @the-bay-kay can use the DFC fermata opcodes without having to set up the local config server?

Once the e-mission-phone repository is set up, I will replace the existing version of em-data-collection with integrated_ble

You will also need to replace the usercache plugin. I have merged that and created a new release
https://github.com/e-mission/cordova-usercache/releases/tag/v1.1.9

@the-bay-kay
Copy link

This is flipped. A visit is time spent at a place. So visit start = trip end and vice versa

Thanks for the clarification! Updated the procedures.

This will work for iOS only... So on android, you will need to start a trip (using "Start trip") and then move the beacon near/far. Also, on android, the trip end is still based on the location based trip end, so geofence based exit is not meaningful.

Ah, correct -- thank you for the reminder! Updated accordingly, LMK if I understood the Android version correctly.

I am not sure you can log in naively via fleet code... You will need to use a local server that is serving up configs. If you have not done this before, this is non-trivial

I have not done this before. You are referring to this PR, correct? Given I have some spare time this evening, I'll do my best to familiarize myself with the server testing procedure to see if I can't spin it up with a custom config.

@shankari
Copy link
Contributor Author

shankari commented Apr 15, 2024

Given I have some spare time this evening, I'll do my best to familiarize myself with the server testing procedure to see if I can't spin it up with a custom config.

I don't think this will be easy. It is not the e-mission server, it is a server for the config. I would rather just merge the config and then fix it later as we get more information about cars than waste your time figuring that out.

@the-bay-kay
Copy link

First iPhone Test

Test Details

  • Phone Used: 2022 iPhone SE
  • Config Used: Study_Test (Non-Fleet)
  • Test Duration: ~60 Seconds of tracking

Results:

I am happy to report that this test:

  1. Did not crash, and
  2. Appears to have successfully recorded my location for the duration of the test.

Due to PII, I will not be posting the full video of the logs. Furthermore, since the video of the iPhone GUI is a minute of nothing, I will not post that unless requested.

While not the full video, attached below is a segmant of the logs confirming it was recording my location:
Screenshot 2024-04-14 at 9 10 09 PM

@shankari
Copy link
Contributor Author

  • The test phone will be placed inside of the beacon's range before testing.
  • During testing, the beacon will be moved out of range, to simulate an exit.

I don't think this is a useful test. Note that on android, "the trip end is still based on the location based trip end, so geofence based exit is not meaningful."
And

The test phone will be placed inside of the beacon's range before testing.

Means that there is no difference between fleet and non-fleet behavior. When you exit the geofence, location tracking will start.

Instead, you should have:

  • The test phone will be placed outside of the beacon's range before testing.
  • Exit the geofence
  • Then move the beacon in
  • Tracking should only start after beacon is moved in

on Android, there are no visit transitions, so you must use start and end trip transitions.

@shankari
Copy link
Contributor Author

@the-bay-kay that's very promising!

we need to confirm a few details:

  • before the beacon was brought into range, no location was being recorded
  • after the beacon was brought into range, both ble and location were recorded (this should be in the logs too)

Once that is confirmed, you just need to do the same on android, and I can generate a staging release!

@JGreenlee
Copy link

Yes e-mission/nrel-openpath-deploy-configs#89 can be merged

@shankari
Copy link
Contributor Author

@the-bay-kay the fermata config has now been updated, so you should be able to just use a fermata opcode

@the-bay-kay
Copy link

the-bay-kay commented Apr 15, 2024

  • The test phone will be placed outside of the beacon's range before testing.
  • Exit the geofence
  • Then move the beacon in
  • Tracking should only start after beacon is moved in

Ah, perhaps I misunderstood -- that was my plan originally, I may have been unclear in the way I wrote it. Those steps were what I had planned for both OSs -- LMK if I'm mistaken, and should do something differently for iOS. Either way, I'll update the Android side of the protocol now.

Once that is confirmed, you just need to do the same on android, and I can generate a staging release!

Will do! I'm getting the Android version set up, I'll:

  • Run the beacon tests with the iPhone SE on the Fermata OpCode
  • Run the full set of tests on the LGv30

@shankari
Copy link
Contributor Author

Ah, perhaps I misunderstood -- that was my plan originally, I may have been unclear in the way I wrote it.

Just to re-clarify, there are two axes to this: the proximity of the BLE to the phone, and whether the phone has received a geofence exit.

On android, only the case of geofence exit -> BLE proximity should start tracking
On iOS, both geofence exit -> BLE proximity and BLE proximity -> geofence exit should start tracking

In your test case above, you are only testing geofence -> BLE proximity, which is fine for putting this on to staging. But once we put it on to staging and want to test more, we should also test having the beacon near the phone without the forced transition. This should (currently) start tracking on iOS but not on android.

@the-bay-kay
Copy link

In your test case above, you are only testing geofence -> BLE proximity, which is fine for putting this on to staging. But once we put it on to staging and want to test more, we should also test having the beacon near the phone without the forced transition.

Ah, yes! Thank you for the clarification. Android on deck and the iOS / Beacon set up, running the next round of tests now.

@the-bay-kay
Copy link

Android Staging Tests: LGv30

With the changes merged into staging, my tests are performed with that installation, rather than through the build chain described above. Below are my initial findings:

Non-Fleet Config:

Simulating a trip as described above, logcat shows that tracking occurs as normal:

04-15 09:30:37.876 24044 26049 D LocationChangeIntentService: After filtering at -1.0 number of points goes from 9 -> 9
04-15 09:30:37.876 24044 26049 D LocationChangeIntentService: After filtering at -1.0 number of points goes from 9 -> 9
04-15 09:30:37.876 24044 26049 D LocationChangeIntentService: last10Points.length = 9
04-15 09:30:37.876 24044 26049 D LocationChangeIntentService: points5MinsAgo.length = 9
04-15 09:30:37.876 24044 26049 I LocationChangeIntentService: last10Points.length = 9 points5MinsAgo.length = 9 points, not enough to decide, returning false

Fleet Config:

These tests were conducted as described in the above posts.

Within these tests, I noticed two beacons being frequently ranged, yet not recorded:

  • UUID: 50765cb7-d9ea-4e21-99a4-fa879613a492
  • UUID: 74278bda-b644-4520-8f0c-720eaf059935

Using a BLE monitoring app (The iBKS config tool), it appears that neither of these beacons are actually within range. This seems exceptionally strange -- I cannot find any reference to these UUIDs within our code either. Any insight into these erroneous beacons would be helpful

Luckily, it appears that these beacons do not get stored into BuiltinUserCache, as can be seen in the final set of logs below. I'll go into more detail in each section:

No Beacon within Range

Without the beacons in range, this is what the majority of the logs look like (e.g., ignoring user interaction logs such as ViewRootImpl). Notice that these two erroneous beacons are being found, but (i) they are not being recorded to BuiltinUserCache, and (ii) We do not see any calls to LocationChangeIntentService.

04-15 09:52:04.647 24044 24044 D BluetoothService: Range notifier called...
04-15 09:52:04.647 24044 24044 D BluetoothService: Found beacons [id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737]
04-15 09:52:05.753 24044 24044 D BluetoothService: Range notifier called...
04-15 09:52:05.754 24044 24044 D BluetoothService: Found beacons [id1: 74278bda-b644-4520-8f0c-720eaf059935 id2: 0 id3: 62946, id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737]
04-15 09:52:06.862 24044 24044 D BluetoothService: Range notifier called...
04-15 09:52:06.863 24044 24044 D BluetoothService: Found beacons [id1: 74278bda-b644-4520-8f0c-720eaf059935 id2: 0 id3: 62946, id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737]

Logs after beacon enters range:

It appears that we are successfully detecting the beacon bf3df3b1-6e46-35fa-86e5-927c95dd096c, and recording it to BuiltinUserCache. Unfortunately, I did not see any logs from LocationChangeIntentService. Shouldn't we have noticed a change in location behavior after this? Perhaps I am misunderstanding what the logs will look like during successful tracking. As with the previous set of logs, these were the only outputs I viewed, beyond user interaction.

04-15 09:55:39.981 24044 24044 D BluetoothService: Found beacons [id1: 74278bda-b644-4520-8f0c-720eaf059935 id2: 0 id3: 62946, id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 1972]
04-15 09:55:39.984 24044 24044 D BuiltinUserCache: Added value for key background/bluetooth_ble at time 1.713200139983E9
04-15 09:55:41.090 24044 24044 D BluetoothService: Range notifier called...
04-15 09:55:41.091 24044 24044 D BluetoothService: Found beacons [id1: 74278bda-b644-4520-8f0c-720eaf059935 id2: 0 id3: 62946, id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 1972]
04-15 09:55:41.094 24044 24044 D BuiltinUserCache: Added value for key background/bluetooth_ble at time 1.713200141093E9
04-15 09:55:42.202 24044 24044 D BluetoothService: Range notifier called...
04-15 09:55:42.203 24044 24044 D BluetoothService: Found beacons [id1: 74278bda-b644-4520-8f0c-720eaf059935 id2: 0 id3: 62946, id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 1972]
04-15 09:55:42.208 24044 24044 D BuiltinUserCache: Added value for key background/bluetooth_ble at time 1.713200142206E9
04-15 09:55:43.314 24044 24044 D BluetoothService: Range notifier called...

@louisg1337
Copy link

Android Tests

I ran two tests, both on the staging version of the app.

  1. With DFC Fermata Opcode
    Using the Developer Zone force transition tools, I simulated a geofence exit and it appears to work fine in the foreground. The beacons start ranging and the location eventually starts once ble_beacon_found is sent. However, when the app is in the background the ranging does not seem to continue, and in turn the location tracking never turns on. I then decided to go on a quick walk to test it out, so I deleted the app and restarted from a fresh slate, and when I came back from my 10-15 minute walk the trip did not show up (and still hasn't).

  2. With Normal Opcode
    I just used the same transition button in the Developer Zone and the location tracking began to work just fine. I have yet to take it on a walk but nothing looks too out of the blue!

@shankari
Copy link
Contributor Author

However, when the app is in the background the ranging does not seem to continue, and in turn the location tracking never turns on.

This is concerning. I thought you said that with the foreground service, the ranging does work and you were able to see trips on dfc-fermata before. Is the foreground service not running properly any more?

@the-bay-kay
Copy link

the-bay-kay commented Apr 15, 2024

However, when the app is in the background the ranging does not seem to continue, and in turn the location tracking never turns on

When moving the app to the background, these are the logs I'm getting (with activity pausing with CordovaActivity: Stopped the Activity).

04-15 10:29:15.870 24044 24044 D BluetoothService: Found beacons [id1: 50765cb7-d9ea-4e21-99a4-fa879613a492 id2: 54006 id3: 53737]
04-15 10:29:16.583 24044 24044 I ScanJob : Using immediateScanJobId from manifest: 208352939
04-15 10:29:16.584 24044 24044 I ScanJob : Using periodicScanJobId from manifest: 208352940
04-15 10:29:16.584 24044 24044 W JobInfo : Requested interval +5m10s0ms for job 208352940 is too small; raising to +15m0s0ms
04-15 10:29:16.584 24044 24044 W JobInfo : Requested flex 0 for job 208352940 is too small; raising to +5m0s0ms
04-15 10:29:16.606 24044 24044 D CordovaActivity: Paused the activity.
04-15 10:29:16.620 24044 24044 I ScanJob : Using periodicScanJobId from manifest: 208352940
04-15 10:29:16.620 24044 24044 I ScanJob : onStopJob called for immediate scan org.altbeacon.beacon.service.ScanJob@9bd1542
04-15 10:29:16.620 24044 24044 I ScanJob : ScanJob Lifecycle STOP: org.altbeacon.beacon.service.ScanJob@9bd1542
04-15 10:29:16.623 24044 24044 D BluetoothAdapter: isLeEnabled(): ON
04-15 10:29:16.627 24044 32518 D BluetoothAdapter: isLeEnabled(): ON
04-15 10:29:16.627 24044 24044 D BluetoothService: Range notifier called...
04-15 10:29:16.634 24044 24044 D BluetoothAdapter: isLeEnabled(): ON
04-15 10:29:16.635 24044 32518 D BluetoothAdapter: isLeEnabled(): ON
04-15 10:29:16.638 24044 32518 D BluetoothLeScanner: could not find callback wrapper
04-15 10:29:16.671 24044 24044 D CordovaActivity: Stopped the activity.

When the app is re-opened, Range notifier called ... continues as before.

@louisg1337
Copy link

This is concerning. I thought you said that with the foreground service, the ranging does work and you were able to see trips on dfc-fermata before. Is the foreground service not running properly any more?

I'm not sure, when I did my tests I would have the app closed, then trigger a broadcast using adb, and the ranging would come on. Whats weirder is that with the version that I worked on, it was actually tracking trips I had a bunch of trips that successfully tracked with my beacon. I'll look at all the changes again and see if I could find what could have caused this deviation.

When the app is re-opened, Range notifier called ... continues as before.

Same thing happens here, right when I open the app back up it starts ranging again.

@louisg1337
Copy link

Potential Issue

I'm just going to put a bunch of potential issues that I think could have happened here. I'll keep on adding to the list as I find more things!

  1. As we are now ranging 600 times, maybe we are taking up too much memory and are causing a bottleneck where the foreground service can't run. BluetoothService is a Service so it runs on the main thread, so that could potentially be an issue. As we were only ranging 4 times before, maybe is was just enough that it wouldn't bog down the main thread too much.

@shankari
Copy link
Contributor Author

shankari commented Apr 15, 2024

I can verify that I can reproduce this in the emulator

$ grep "BluetoothService" /tmp/logcat.log
04-15 10:55:50.693  8585  8585 D BluetoothService: Range notifier called...
04-15 10:55:51.803  8585  8585 D BluetoothService: Range notifier called...
04-15 10:55:52.911  8585  8585 D BluetoothService: Range notifier called...
04-15 10:55:53.742  8585  8585 D BluetoothService: Range notifier called...
04-15 11:06:07.389  8585  8585 D BluetoothService: Range notifier called...

This also appears to be expected behavior https://stackoverflow.com/a/73970568 if the foreground service is not configured.

For constant background scanning you may configure the library to use a foreground service or the intent scan strategy.

@louisg1337 I checked the code and my changes (e-mission/e-mission-data-collection@04e0a19) and I am not sure how this ever worked
The way that the service is started now

                    Intent foregroundStartBluetooth = new Intent(ctxt, TripDiaryStateMachineForegroundService.class);
                    foregroundStartBluetooth.setAction("foreground_start_bluetooth");
                    ctxt.startService(foregroundStartBluetooth);

appears to be substantially the same as what we had before

            Intent foregroundStartBluetooth = new Intent(ctxt, TripDiaryStateMachineForegroundService.class);
            foregroundStartBluetooth.setAction("foreground_start_bluetooth");
            ctxt.startService(foregroundStartBluetooth);

And I don't see anything marking the service as starting in the foreground. Maybe you made a local change that you tested but didn't commit/push?

@shankari
Copy link
Contributor Author

Although, for the record, it is not clear that we need to mark this as a foreground service. The entire e-mission app has one foreground service, and all the other services (FSM, location, motion activity etc) run just fine in the background.

@louisg1337
Copy link

Android Testing Update

I unfortunately sent us on a witch hunt because it seemed like the trip I took earlier didn't track/do anything. It turns out I just didn't wait long enough for the server to process my trip, as it eventually did appear, albeit after a little while.

We also ran into the rabbit hole of why the beacon ranging logs did not appear in the adb logcat when the app was in the background. We now believe that this is because the app may only scan in the background if there is a beacon nearby. We're going to do future tests to see if ranging will occur in the background if we bring a beacon into range after we started ranging. Will update as soon as that is done!

@louisg1337
Copy link

louisg1337 commented Apr 15, 2024

Testing Android Background Scanning

App in background with beacon nearby

Started geofence exit at 2:29, then immediately moved app to the background and locked phone. Reopened the app and emailed the logs at 2:32.

9234,1713205777.274,2024-04-15T14:29:37.274000-04:00,TripDiaryStateMachineService : TripDiaryStateMachineReceiver handleTripStart(local.transition.exited_geofence) called
9235,1713205777.275,2024-04-15T14:29:37.275000-04:00,"TripDiaryStateMachineService : Geofence exit in fleet mode, checking for beacons before starting location tracking"
9236,1713205777.277,2024-04-15T14:29:37.277000-04:00,"TripDiaryStateMachineService : handleAction(local.state.waiting_for_trip_start, local.transition.exited_geofence) completed, waiting for async operations to complete"
9237,1713205777.278,2024-04-15T14:29:37.278000-04:00,TripDiaryStateMachineForegroundService : onStartCommand called with intent = Intent { act=foreground_start_bluetooth cmp=gov.nrel.cims.openpath/edu.berkeley.eecs.emission.cordova.tracker.location.TripDiaryStateMachineForegroundService } flags = 0 and startId = 8
9238,1713205777.301,2024-04-15T14:29:37.301000-04:00,BluetoothService : onStartCommand called!!!!
9239,1713205777.302,2024-04-15T14:29:37.302000-04:00,BluetoothService : startBeaconScan called!!!!
9240,1713205778.505,2024-04-15T14:29:38.505000-04:00,BluetoothService : Range notifier called...
9241,1713205778.508,2024-04-15T14:29:38.508000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9242,1713205778.51,2024-04-15T14:29:38.510000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205778509E9
9243,1713205778.511,2024-04-15T14:29:38.511000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205778511E9
9244,1713205779.613,2024-04-15T14:29:39.613000-04:00,BluetoothService : Range notifier called...
9245,1713205779.616,2024-04-15T14:29:39.616000-04:00,"BluetoothService : Found beacons [id1: e2c56db5-dffb-48d2-b060-d0f5a71096e0 id2: 28528 id3: 26898, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9246,1713205779.619,2024-04-15T14:29:39.619000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205779618E9
9247,1713205780.722,2024-04-15T14:29:40.722000-04:00,BluetoothService : Range notifier called...
9248,1713205780.726,2024-04-15T14:29:40.726000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
9249,1713205781.828,2024-04-15T14:29:41.828000-04:00,BluetoothService : Range notifier called...
9250,1713205781.832,2024-04-15T14:29:41.832000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9251,1713205781.835,2024-04-15T14:29:41.835000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205781834E9
9252,1713205782.937,2024-04-15T14:29:42.937000-04:00,BluetoothService : Range notifier called...
9253,1713205782.941,2024-04-15T14:29:42.941000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9254,1713205782.943,2024-04-15T14:29:42.943000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205782942E9
9255,1713205782.945,2024-04-15T14:29:42.945000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205782944E9
9256,1713205784.048,2024-04-15T14:29:44.048000-04:00,BluetoothService : Range notifier called...
9257,1713205784.052,2024-04-15T14:29:44.052000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
9258,1713205785.155,2024-04-15T14:29:45.155000-04:00,BluetoothService : Range notifier called...
9259,1713205785.16,2024-04-15T14:29:45.160000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9260,1713205785.162,2024-04-15T14:29:45.162000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205785161E9
9261,1713205785.165,2024-04-15T14:29:45.165000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205785164E9
9262,1713205786.267,2024-04-15T14:29:46.267000-04:00,BluetoothService : Range notifier called...
9263,1713205786.271,2024-04-15T14:29:46.271000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
9264,1713205787.373,2024-04-15T14:29:47.373000-04:00,BluetoothService : Range notifier called...
9265,1713205787.376,2024-04-15T14:29:47.376000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9266,1713205787.379,2024-04-15T14:29:47.379000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205787378E9
9267,1713205788.481,2024-04-15T14:29:48.481000-04:00,BluetoothService : Range notifier called...
9268,1713205788.484,2024-04-15T14:29:48.484000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9269,1713205788.486,2024-04-15T14:29:48.486000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205788485E9
9270,1713205789.588,2024-04-15T14:29:49.588000-04:00,BluetoothService : Range notifier called...
9271,1713205789.591,2024-04-15T14:29:49.591000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9272,1713205789.594,2024-04-15T14:29:49.594000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205789593E9
9273,1713205790.696,2024-04-15T14:29:50.696000-04:00,BluetoothService : Range notifier called...
9274,1713205790.699,2024-04-15T14:29:50.699000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9275,1713205790.702,2024-04-15T14:29:50.702000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205790701E9
9276,1713205791.805,2024-04-15T14:29:51.805000-04:00,BluetoothService : Range notifier called...
9277,1713205791.808,2024-04-15T14:29:51.808000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
9278,1713205791.811,2024-04-15T14:29:51.811000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.71320579181E9
9279,1713205792.913,2024-04-15T14:29:52.913000-04:00,BluetoothService : Range notifier called...
9280,1713205792.916,2024-04-15T14:29:52.916000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
9281,1713205792.918,2024-04-15T14:29:52.918000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205792918E9
9282,1713205794.021,2024-04-15T14:29:54.021000-04:00,BluetoothService : Range notifier called...
9283,1713205794.025,2024-04-15T14:29:54.025000-04:00,"BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9284,1713205794.027,2024-04-15T14:29:54.027000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205794026E9
9285,1713205795.132,2024-04-15T14:29:55.132000-04:00,BluetoothService : Range notifier called...
9286,1713205795.135,2024-04-15T14:29:55.135000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9287,1713205795.138,2024-04-15T14:29:55.138000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205795137E9
9288,1713205795.14,2024-04-15T14:29:55.140000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205795139E9
9289,1713205796.242,2024-04-15T14:29:56.242000-04:00,BluetoothService : Range notifier called...
9290,1713205796.245,2024-04-15T14:29:56.245000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
9291,1713205796.248,2024-04-15T14:29:56.248000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205796247E9
9292,1713205797.352,2024-04-15T14:29:57.352000-04:00,BluetoothService : Range notifier called...
9293,1713205797.356,2024-04-15T14:29:57.356000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9294,1713205797.358,2024-04-15T14:29:57.358000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205797357E9
9295,1713205797.36,2024-04-15T14:29:57.360000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205797359E9
9296,1713205798.462,2024-04-15T14:29:58.462000-04:00,BluetoothService : Range notifier called...
9297,1713205798.466,2024-04-15T14:29:58.466000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
9298,1713205798.468,2024-04-15T14:29:58.468000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205798467E9
9299,1713205799.573,2024-04-15T14:29:59.573000-04:00,BluetoothService : Range notifier called...
9300,1713205799.576,2024-04-15T14:29:59.576000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
9301,1713205800.679,2024-04-15T14:30:00.679000-04:00,BluetoothService : Range notifier called...
9302,1713205800.682,2024-04-15T14:30:00.682000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9303,1713205800.684,2024-04-15T14:30:00.684000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205800684E9
9304,1713205800.686,2024-04-15T14:30:00.686000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205800686E9
9305,1713205801.788,2024-04-15T14:30:01.788000-04:00,BluetoothService : Range notifier called...
9306,1713205801.792,2024-04-15T14:30:01.792000-04:00,BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]
9307,1713205801.794,2024-04-15T14:30:01.794000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205801793E9
9308,1713205802.769,2024-04-15T14:30:02.769000-04:00,js : new AppState: background
9309,1713205802.772,2024-04-15T14:30:02.772000-04:00,BluetoothService : Range notifier called...
9310,1713205802.774,2024-04-15T14:30:02.774000-04:00,BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535]
9311,1713205802.779,2024-04-15T14:30:02.779000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205802777E9
9312,1713205927.278,2024-04-15T14:32:07.278000-04:00,DataCollectionPlugin : onNewIntent(android.intent.action.MAIN)
9313,1713205927.283,2024-04-15T14:32:07.283000-04:00,DataCollectionPlugin : Found extras null
9314,1713205927.284,2024-04-15T14:32:07.284000-04:00,"SensorPermissionsAndSettingsForegroundDelegate : onNewIntent(Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10600000 cmp=gov.nrel.cims.openpath/.MainActivity bnds=[443,313][636,641] }) received, ignoring"
9315,1713205927.293,2024-04-15T14:32:07.293000-04:00,"DataCollectionPlugin : On resume, check for foreground service only if user has conesented."
9316,1713205927.295,2024-04-15T14:32:07.295000-04:00,"DataCollectionPlugin : User has consented, proceed with foreground check."
9317,1713205927.297,2024-04-15T14:32:07.297000-04:00,"TripDiaryStateMachineForegroundService : In checkForegroundNotification, found 1 active notifications"
9318,1713205927.297,2024-04-15T14:32:07.297000-04:00,TripDiaryStateMachineForegroundService : Found foreground notification with ID 6646464 nothing to do
9319,1713205927.354,2024-04-15T14:32:07.354000-04:00,"js : PERMISSION CHECK: app has resumed, should refresh"
9320,1713205927.356,2024-04-15T14:32:07.356000-04:00,js : Refresh location settings
9321,1713205927.358,2024-04-15T14:32:07.358000-04:00,"js : checking object Location Settings {""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9322,1713205927.359,2024-04-15T14:32:07.359000-04:00,DataCollectionPlugin : checking location settings
9323,1713205927.36,2024-04-15T14:32:07.360000-04:00,SensorControlChecks : About to check location settings
9324,1713205927.361,2024-04-15T14:32:07.361000-04:00,"LocationTrackingAction : default request is Request[@1h BALANCED_POWER_ACCURACY, minUpdateInterval=10m, waitForAccurateLocation]"
9325,1713205927.363,2024-04-15T14:32:07.363000-04:00,"LocationTrackingAction : after applying config, value is Request[@30s HIGH_ACCURACY, minUpdateInterval=5s, waitForAccurateLocation]"
9326,1713205927.364,2024-04-15T14:32:07.364000-04:00,"SensorControlChecks : Checking location settings for request Request[@30s HIGH_ACCURACY, minUpdateInterval=5s, waitForAccurateLocation]"
9327,1713205927.365,2024-04-15T14:32:07.365000-04:00,SensorControlChecks : Got back result com.google.android.gms.tasks.zzw@9f0e071
9328,1713205927.368,2024-04-15T14:32:07.368000-04:00,js : fix and refresh location permissions
9329,1713205927.371,2024-04-15T14:32:07.371000-04:00,"js : checking object Location Permissions {""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9330,1713205927.373,2024-04-15T14:32:07.373000-04:00,"SensorPermissionsAndSettingsForegroundDelegate : All settings are valid, checking current state"
9331,1713205927.373,2024-04-15T14:32:07.373000-04:00,DataCollectionPlugin : checking location permissions
9332,1713205927.374,2024-04-15T14:32:07.374000-04:00,SensorPermissionsAndSettingsForegroundDelegate : Current location settings are com.google.android.gms.location.LocationSettingsStates@93a2ca9
9333,1713205927.378,2024-04-15T14:32:07.378000-04:00,js : fix and refresh fitness permissions
9334,1713205927.382,2024-04-15T14:32:07.382000-04:00,"js : checking object Fitness Permission {""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9335,1713205927.385,2024-04-15T14:32:07.385000-04:00,DataCollectionPlugin : checking fitness permissions
9336,1713205927.388,2024-04-15T14:32:07.388000-04:00,js : fix and refresh bluetooth permissions
9337,1713205927.389,2024-04-15T14:32:07.389000-04:00,"js : checking object Bluetooth scan permission {""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9338,1713205927.395,2024-04-15T14:32:07.395000-04:00,DataCollectionPlugin : checking bluetooth permissions
9339,1713205927.396,2024-04-15T14:32:07.396000-04:00,SensorControlChecks : version32Check false permCheck true retVal = true
9340,1713205927.399,2024-04-15T14:32:07.399000-04:00,js : fix and refresh notification permissions
9341,1713205927.401,2024-04-15T14:32:07.401000-04:00,"js : checking object App Notifications {""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9342,1713205927.402,2024-04-15T14:32:07.402000-04:00,DataCollectionPlugin : checking notification enable
9343,1713205927.404,2024-04-15T14:32:07.404000-04:00,js : fix and refresh backgroundRestriction permissions
9344,1713205927.405,2024-04-15T14:32:07.405000-04:00,"js : checking object Unused apps disabled {""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9345,1713205927.407,2024-04-15T14:32:07.407000-04:00,DataCollectionPlugin : checking unused app restrictions
9346,1713205927.411,2024-04-15T14:32:07.411000-04:00,SensorControlChecks : About to call future.get to read the restriction status
9347,1713205927.413,2024-04-15T14:32:07.413000-04:00,SensorControlChecks : Received 2 from future.get
9348,1713205927.415,2024-04-15T14:32:07.415000-04:00,js : fix and refresh battery optimization permissions
9349,1713205927.416,2024-04-15T14:32:07.416000-04:00,"js : checking object Ignore battery optimizations {""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
9350,1713205927.417,2024-04-15T14:32:07.417000-04:00,DataCollectionPlugin : checking ignored battery optimizations
9351,1713205927.419,2024-04-15T14:32:07.419000-04:00,"js : After refreshing all checks, checks are [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9352,1713205927.421,2024-04-15T14:32:07.421000-04:00,js : new AppState: active
9353,1713205927.422,2024-04-15T14:32:07.422000-04:00,js : availability = OK
9354,1713205927.424,2024-04-15T14:32:07.424000-04:00,"js : after checking obj Location Permissions, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9355,1713205927.427,2024-04-15T14:32:07.427000-04:00,js : availability = OK
9356,1713205927.432,2024-04-15T14:32:07.432000-04:00,"js : after checking obj Fitness Permission, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9357,1713205927.435,2024-04-15T14:32:07.435000-04:00,js : availability = OK
9358,1713205927.437,2024-04-15T14:32:07.437000-04:00,"js : after checking obj Bluetooth scan permission, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9359,1713205927.438,2024-04-15T14:32:07.438000-04:00,js : availability = OK
9360,1713205927.44,2024-04-15T14:32:07.440000-04:00,"js : after checking obj App Notifications, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9361,1713205927.443,2024-04-15T14:32:07.443000-04:00,js : availability = OK
9362,1713205927.445,2024-04-15T14:32:07.445000-04:00,"js : after checking obj Unused apps disabled, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9363,1713205927.447,2024-04-15T14:32:07.447000-04:00,js : availability = OK
9364,1713205927.449,2024-04-15T14:32:07.449000-04:00,"js : after checking obj Ignore battery optimizations, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9365,1713205927.451,2024-04-15T14:32:07.451000-04:00,js : availability = com.google.android.gms.location.LocationSettingsStates@93a2ca9
9366,1713205927.453,2024-04-15T14:32:07.453000-04:00,"js : after checking obj Location Settings, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
9367,1713205927.464,2024-04-15T14:32:07.464000-04:00,js : check in permission status for Location Settings:true
9368,1713205927.466,2024-04-15T14:32:07.466000-04:00,js : check in permission status for Location Permissions:true
9369,1713205927.467,2024-04-15T14:32:07.467000-04:00,js : check in permission status for Fitness Permission:true
9370,1713205927.469,2024-04-15T14:32:07.469000-04:00,js : check in permission status for Bluetooth scan permission:true
9371,1713205927.47,2024-04-15T14:32:07.470000-04:00,js : check in permission status for App Notifications:true
9372,1713205927.471,2024-04-15T14:32:07.471000-04:00,js : check in permission status for Unused apps disabled:true
9373,1713205927.472,2024-04-15T14:32:07.472000-04:00,js : check in permission status for Ignore battery optimizations:true
9374,1713205927.482,2024-04-15T14:32:07.482000-04:00,"js : parseState: state = local.state.waiting_for_trip_start; 
      platformId = android"
9375,1713205927.484,2024-04-15T14:32:07.484000-04:00,js : platform ANDROID; parsed state will be waiting_for_trip_start
9376,1713205928.477,2024-04-15T14:32:08.477000-04:00,BluetoothService : Range notifier called...
9377,1713205928.479,2024-04-15T14:32:08.479000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0, id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 69]"
9378,1713205928.481,2024-04-15T14:32:08.481000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.71320592848E9
9379,1713205928.482,2024-04-15T14:32:08.482000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713205928482E9
9380,1713205929.583,2024-04-15T14:32:09.583000-04:00,BluetoothService : Range notifier called...
9381,1713205929.586,2024-04-15T14:32:09.586000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
9382,1713205929.626,2024-04-15T14:32:09.626000-04:00,js : Going to email loggerDB

App in background with no beacon and then beacon

In this test we wanted to see what would happen when you start a geofence exit with no beacons around, move the app into the background, and then bring beacons into range. It appears that the rangeNotifier only returns when we see beacons in the region.

At 2:49 I exited the geofence and moved the app to the background. We do pick up a random beacon in the region, but that is not the deployment beacon we are using. Then at around 2:53 I move the beacon back in range and we start getting call backs from the rangeNotifier.

11512,1713206975.627,2024-04-15T14:49:35.627000-04:00,"TripDiaryStateMachineService : Geofence exit in fleet mode, checking for beacons before starting location tracking"
11513,1713206975.629,2024-04-15T14:49:35.629000-04:00,"TripDiaryStateMachineService : handleAction(local.state.waiting_for_trip_start, local.transition.exited_geofence) completed, waiting for async operations to complete"
11514,1713206975.662,2024-04-15T14:49:35.662000-04:00,TripDiaryStateMachineForegroundService : onStartCommand called with intent = Intent { act=foreground_start_bluetooth cmp=gov.nrel.cims.openpath/edu.berkeley.eecs.emission.cordova.tracker.location.TripDiaryStateMachineForegroundService } flags = 0 and startId = 9
11515,1713206975.673,2024-04-15T14:49:35.673000-04:00,BluetoothService : onStartCommand called!!!!
11516,1713206975.675,2024-04-15T14:49:35.675000-04:00,BluetoothService : startBeaconScan called!!!!
11517,1713206975.693,2024-04-15T14:49:35.693000-04:00,BluetoothService : Range notifier called...
11518,1713206975.695,2024-04-15T14:49:35.695000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11519,1713206976.882,2024-04-15T14:49:36.882000-04:00,BluetoothService : Range notifier called...
11520,1713206976.885,2024-04-15T14:49:36.885000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11521,1713206977.991,2024-04-15T14:49:37.991000-04:00,BluetoothService : Range notifier called...
11522,1713206977.993,2024-04-15T14:49:37.993000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11523,1713206979.095,2024-04-15T14:49:39.095000-04:00,BluetoothService : Range notifier called...
11524,1713206979.097,2024-04-15T14:49:39.097000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11525,1713206979.195,2024-04-15T14:49:39.195000-04:00,js : new AppState: background
11526,1713206979.206,2024-04-15T14:49:39.206000-04:00,BluetoothService : Range notifier called...
11527,1713207188.929,2024-04-15T14:53:08.929000-04:00,"DataCollectionPlugin : On resume, check for foreground service only if user has conesented."
11528,1713207188.936,2024-04-15T14:53:08.936000-04:00,"DataCollectionPlugin : User has consented, proceed with foreground check."
11529,1713207188.939,2024-04-15T14:53:08.939000-04:00,"TripDiaryStateMachineForegroundService : In checkForegroundNotification, found 1 active notifications"
11530,1713207188.939,2024-04-15T14:53:08.939000-04:00,TripDiaryStateMachineForegroundService : Found foreground notification with ID 6646464 nothing to do
11531,1713207188.981,2024-04-15T14:53:08.981000-04:00,"js : PERMISSION CHECK: app has resumed, should refresh"
11532,1713207188.983,2024-04-15T14:53:08.983000-04:00,js : Refresh location settings
11533,1713207188.987,2024-04-15T14:53:08.987000-04:00,"js : checking object Location Settings {""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11534,1713207188.989,2024-04-15T14:53:08.989000-04:00,DataCollectionPlugin : checking location settings
11535,1713207188.989,2024-04-15T14:53:08.989000-04:00,SensorControlChecks : About to check location settings
11536,1713207188.99,2024-04-15T14:53:08.990000-04:00,"LocationTrackingAction : default request is Request[@1h BALANCED_POWER_ACCURACY, minUpdateInterval=10m, waitForAccurateLocation]"
11537,1713207188.992,2024-04-15T14:53:08.992000-04:00,"LocationTrackingAction : after applying config, value is Request[@30s HIGH_ACCURACY, minUpdateInterval=5s, waitForAccurateLocation]"
11538,1713207188.994,2024-04-15T14:53:08.994000-04:00,"SensorControlChecks : Checking location settings for request Request[@30s HIGH_ACCURACY, minUpdateInterval=5s, waitForAccurateLocation]"
11539,1713207189.0,2024-04-15T14:53:09-04:00,SensorControlChecks : Got back result com.google.android.gms.tasks.zzw@68f6a7d
11540,1713207189.003,2024-04-15T14:53:09.003000-04:00,js : fix and refresh location permissions
11541,1713207189.006,2024-04-15T14:53:09.006000-04:00,"js : checking object Location Permissions {""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11542,1713207189.013,2024-04-15T14:53:09.013000-04:00,DataCollectionPlugin : checking location permissions
11543,1713207189.02,2024-04-15T14:53:09.020000-04:00,js : fix and refresh fitness permissions
11544,1713207189.023,2024-04-15T14:53:09.023000-04:00,"js : checking object Fitness Permission {""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11545,1713207189.025,2024-04-15T14:53:09.025000-04:00,DataCollectionPlugin : checking fitness permissions
11546,1713207189.033,2024-04-15T14:53:09.033000-04:00,"SensorPermissionsAndSettingsForegroundDelegate : All settings are valid, checking current state"
11547,1713207189.035,2024-04-15T14:53:09.035000-04:00,js : fix and refresh bluetooth permissions
11548,1713207189.036,2024-04-15T14:53:09.036000-04:00,SensorPermissionsAndSettingsForegroundDelegate : Current location settings are com.google.android.gms.location.LocationSettingsStates@ba73e40
11549,1713207189.04,2024-04-15T14:53:09.040000-04:00,"js : checking object Bluetooth scan permission {""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11550,1713207189.042,2024-04-15T14:53:09.042000-04:00,DataCollectionPlugin : checking bluetooth permissions
11551,1713207189.043,2024-04-15T14:53:09.043000-04:00,SensorControlChecks : version32Check false permCheck true retVal = true
11552,1713207189.05,2024-04-15T14:53:09.050000-04:00,js : fix and refresh notification permissions
11553,1713207189.055,2024-04-15T14:53:09.055000-04:00,"js : checking object App Notifications {""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11554,1713207189.058,2024-04-15T14:53:09.058000-04:00,DataCollectionPlugin : checking notification enable
11555,1713207189.079,2024-04-15T14:53:09.079000-04:00,js : fix and refresh backgroundRestriction permissions
11556,1713207189.087,2024-04-15T14:53:09.087000-04:00,"js : checking object Unused apps disabled {""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11557,1713207189.09,2024-04-15T14:53:09.090000-04:00,DataCollectionPlugin : checking unused app restrictions
11558,1713207189.102,2024-04-15T14:53:09.102000-04:00,SensorControlChecks : About to call future.get to read the restriction status
11559,1713207189.105,2024-04-15T14:53:09.105000-04:00,SensorControlChecks : Received 2 from future.get
11560,1713207189.113,2024-04-15T14:53:09.113000-04:00,js : fix and refresh battery optimization permissions
11561,1713207189.117,2024-04-15T14:53:09.117000-04:00,"js : checking object Ignore battery optimizations {""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}"
11562,1713207189.119,2024-04-15T14:53:09.119000-04:00,DataCollectionPlugin : checking ignored battery optimizations
11563,1713207189.13,2024-04-15T14:53:09.130000-04:00,"js : After refreshing all checks, checks are [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11564,1713207189.133,2024-04-15T14:53:09.133000-04:00,js : new AppState: active
11565,1713207189.141,2024-04-15T14:53:09.141000-04:00,js : availability = OK
11566,1713207189.147,2024-04-15T14:53:09.147000-04:00,"js : after checking obj Location Permissions, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11567,1713207189.154,2024-04-15T14:53:09.154000-04:00,js : availability = OK
11568,1713207189.156,2024-04-15T14:53:09.156000-04:00,"js : after checking obj Fitness Permission, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11569,1713207189.164,2024-04-15T14:53:09.164000-04:00,js : availability = OK
11570,1713207189.172,2024-04-15T14:53:09.172000-04:00,"js : after checking obj Bluetooth scan permission, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11571,1713207189.174,2024-04-15T14:53:09.174000-04:00,js : availability = OK
11572,1713207189.185,2024-04-15T14:53:09.185000-04:00,"js : after checking obj App Notifications, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11573,1713207189.193,2024-04-15T14:53:09.193000-04:00,js : availability = OK
11574,1713207189.197,2024-04-15T14:53:09.197000-04:00,"js : after checking obj Unused apps disabled, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11575,1713207189.209,2024-04-15T14:53:09.209000-04:00,js : availability = OK
11576,1713207189.217,2024-04-15T14:53:09.217000-04:00,"js : after checking obj Ignore battery optimizations, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11577,1713207189.222,2024-04-15T14:53:09.222000-04:00,js : availability = com.google.android.gms.location.LocationSettingsStates@ba73e40
11578,1713207189.225,2024-04-15T14:53:09.225000-04:00,"js : after checking obj Location Settings, checkList is [{""name"":""Location Settings"",""desc"":""Location services should be enabled. This allows us to access location data and generate the trip log"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Location Permissions"",""desc"":""On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Fitness Permission"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Bluetooth scan permission"",""desc"":""Scan for BLE beacons to automatically match trips to vehicles"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""App Notifications"",""desc"":""On the app settings page, ensure that all notifications and channels are enabled."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Unused apps disabled"",""desc"":""On the app settings page, turn off 'Pause app activity if unused.'"",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""},{""name"":""Ignore battery optimizations"",""desc"":""Please allow."",""statusState"":true,""statusIcon"":""check-circle-outline"",""statusColor"":""#00a665""}]"
11579,1713207189.234,2024-04-15T14:53:09.234000-04:00,js : check in permission status for Location Settings:true
11580,1713207189.24,2024-04-15T14:53:09.240000-04:00,js : check in permission status for Location Permissions:true
11581,1713207189.242,2024-04-15T14:53:09.242000-04:00,js : check in permission status for Fitness Permission:true
11582,1713207189.249,2024-04-15T14:53:09.249000-04:00,js : check in permission status for Bluetooth scan permission:true
11583,1713207189.251,2024-04-15T14:53:09.251000-04:00,js : check in permission status for App Notifications:true
11584,1713207189.255,2024-04-15T14:53:09.255000-04:00,js : check in permission status for Unused apps disabled:true
11585,1713207189.258,2024-04-15T14:53:09.258000-04:00,js : check in permission status for Ignore battery optimizations:true
11586,1713207189.276,2024-04-15T14:53:09.276000-04:00,"js : parseState: state = local.state.waiting_for_trip_start; 
      platformId = android"
11587,1713207189.28,2024-04-15T14:53:09.280000-04:00,js : platform ANDROID; parsed state will be waiting_for_trip_start
11588,1713207190.175,2024-04-15T14:53:10.175000-04:00,BluetoothService : Range notifier called...
11589,1713207190.179,2024-04-15T14:53:10.179000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11590,1713207190.181,2024-04-15T14:53:10.181000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.71320719018E9
11591,1713207191.281,2024-04-15T14:53:11.281000-04:00,BluetoothService : Range notifier called...
11592,1713207191.283,2024-04-15T14:53:11.283000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11593,1713207192.384,2024-04-15T14:53:12.384000-04:00,BluetoothService : Range notifier called...
11594,1713207192.386,2024-04-15T14:53:12.386000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11595,1713207192.387,2024-04-15T14:53:12.387000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207192387E9
11596,1713207193.488,2024-04-15T14:53:13.488000-04:00,BluetoothService : Range notifier called...
11597,1713207193.49,2024-04-15T14:53:13.490000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11598,1713207194.591,2024-04-15T14:53:14.591000-04:00,BluetoothService : Range notifier called...
11599,1713207194.593,2024-04-15T14:53:14.593000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11600,1713207194.595,2024-04-15T14:53:14.595000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207194594E9
11601,1713207195.696,2024-04-15T14:53:15.696000-04:00,BluetoothService : Range notifier called...
11602,1713207195.704,2024-04-15T14:53:15.704000-04:00,BluetoothService : Found beacons [id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]
11603,1713207196.805,2024-04-15T14:53:16.805000-04:00,BluetoothService : Range notifier called...
11604,1713207196.808,2024-04-15T14:53:16.808000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11605,1713207196.81,2024-04-15T14:53:16.810000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207196809E9
11606,1713207197.911,2024-04-15T14:53:17.911000-04:00,BluetoothService : Range notifier called...
11607,1713207197.912,2024-04-15T14:53:17.912000-04:00,BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535]
11608,1713207197.914,2024-04-15T14:53:17.914000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207197914E9
11609,1713207199.015,2024-04-15T14:53:19.015000-04:00,BluetoothService : Range notifier called...
11610,1713207199.017,2024-04-15T14:53:19.017000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11611,1713207199.019,2024-04-15T14:53:19.019000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207199018E9
11612,1713207199.563,2024-04-15T14:53:19.563000-04:00,js : Going to email loggerDB
11613,1713207200.12,2024-04-15T14:53:20.120000-04:00,BluetoothService : Range notifier called...
11614,1713207200.123,2024-04-15T14:53:20.123000-04:00,"BluetoothService : Found beacons [id1: bf3df3b1-6e46-35fa-86e5-927c95dd096c id2: 57280 id3: 65535, id1: 2686f39c-bada-4658-854a-a62e7e5e8b8d id2: 1 id3: 0]"
11615,1713207200.125,2024-04-15T14:53:20.125000-04:00,BuiltinUserCache : Added value for key background/bluetooth_ble at time 1.713207200124E9

@shankari
Copy link
Contributor Author

A better long-term fix may be the "intent strategy" outlined above. I have not looked into how to enable it, and am not convinced that this will fix anything (given that the app is already running with a foreground service, but it is worth exploring to see if it is better)

https://github.com/AltBeacon/android-beacon-library/blob/7af8419c404329ac7dc6001917b5962d2cd53a11/lib/src/main/java/org/altbeacon/beacon/BeaconManager.java#L738

@the-bay-kay
Copy link

the-bay-kay commented Apr 15, 2024

iOS Tests: iPhone 8

Non-Fleet Config

When simulating a trip exit with Start trip, it appears that we successfully start recording the location! The behavior is documented under the Non-Fleet screenshots.

Fleet Config

No Beacon in Range

When simulating a trip exit with Start trip, it appears that we are not tracking BLE. Please see the screenshot at the end of this post!

Beacon in Range,

When simulating the start of a trip with Start trip, we do not track BLE, as shown above. Then, bringing the beacon into range results in tracking! Again, see the relevant screenshot below.

Beacon Left Range

When first bringing the beacon out of range, we receive a few empty callbacks form "DidRangeBeacons", which is somewhat expected. Eventually, however, we do successfully detect the region exit, and transition back to STATE_WAITING_FOR_TRIP_TO_START! With that in mind, it appears we're successfully detecting the BLE Beacon, and only recording location when said beacon is present 🥳

Screenshots

Non-FLEET

Geofence exit simulation

image

Geofence Deletion

image

Location Recording

image

End of Location Recording

image

FLEET Version

No Beacon In Range, Fleet:

image

Beacon Brought Into Range:

image

Empty "Found Beacon"

image

BLE Region Exit

image

@louisg1337
Copy link

louisg1337 commented Apr 18, 2024

FSM Next Steps

Now that we have pushed out the alpha version of the app for testing, we are faced with the question of where to go next with the FSM. Currently, we have two different integrations of bluetooth in the FSM on iOS and Android. On iOS, we have one that utilizes only monitoring and ranging to start/stop tracking, while on Android we utilize both geofence and ranging for tracking. There are a few weird edge cases that come with both implementations, so we figured we needed to make a few adjustments to it to address those them. To achieve this, we decided to create a truth table to help us identify these potential edge cases.

Truth Table

Screenshot 2024-04-18 at 4 30 16 PM

As can be seen, in line 2 and 4 we have two possibilities of what could occur. Whenever someone is in range of a fleet beacon, but does not trigger an exited geofence action, they can either be 1) hanging out in their car, or 2) driving a different fleet vehicle that happened to be in a different region from their last set up geofence.

It is interesting because iOS works properly for 2 (tracks), but doesn't for 1, as it will track you if you are just hanging out in your car and not moving. And Android works for properly for 1 (doesn't track) but doesn't for 2 because if you were to try driving a different fleet vehicle that is parked outside of the current geofence, the trip won't get tracked.

Given the edge cases above, I think that the FSM flow shown below could work for both 1 and 2.

FSM Proposal

Screenshot 2024-04-18 at 6 34 12 PM

This implementation takes the monitoring functionality from iOS, and the geofence exit + ranging functionality from Android and combines the two. The idea here is that whenever we enter a beacon region, we delete our old geofence and create a new one. Then, if we exit the geofence, we range for beacons, if we find an OpenPATH one we continue tracking, and if not, we return back to waiting for trip to start.

Given this new design, if we think through edge case 1 and 2 from above, this seems like it could work.

1. User is sitting in their car, texting their friend.
With the implementation above, we will now only create a geofence as they walk near their car, and will only track once they exit the geofence with a beacon in range. Therefore, we won't get any erroneous trips where we are tracking someone sitting still in their car.

2. User uses a different fleet vehicle that is outside of their previously set geofence.
It is alright that we are outside of our previous geofence as with this new implementation we will just generate a new one. And then, if we were to drive away, this new geofence will trigger a geofence exit, and we will start tracking. Therefore, the user can utilize any vehicle they want and not worry about having to take the same one always.

With that in mind, the new FSM flow above seems like it would cover those edge cases and also our more common cases as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Issues being worked on
Development

No branches or pull requests

4 participants