transistorsoft / cordova-background-geolocation-firebase

Firebase Adapter for Cordova Background Geolocation
MIT License
7 stars 5 forks source link

Clarification : writing Geofence events to firestore #5

Closed invention7 closed 5 years ago

invention7 commented 5 years ago

Hey Chris,

I know the documentation is 'raw', so I might be missing something on this point.

I've got the plugin writing 'locations' nicely. Geofences : is the expected behavior that it write ENTER/EXIT events to firestore?
If so, I'm seeing ENTER events in my logcat but not a complimentary write to firestore.

Attaching logcat below. Running background-geolocation 2.13.1

Thanks for all the help.

log.txt

christocracy commented 5 years ago

There're being INSERTed. Are you searching

09-19 14:44:24.508 13394 17039 I TSLocationManager: ╔═════════════════════════════════════════════
09-19 14:44:24.508 13394 17039 I TSLocationManager: ║ Geofencing Event: ENTER
09-19 14:44:24.508 13394 17039 I TSLocationManager: ╠═════════════════════════════════════════════
09-19 14:44:24.508 13394 17039 I TSLocationManager: ╟─ 258aa359-80ef-b259-9811-11c77e168367
09-19 14:44:24.508 13394 17039 I TSLocationManager: ╚═════════════════════════════════════════════
09-19 14:44:24.564 13394 17039 D TSLocationManager: [c.t.l.l.TSLocationManager a] 10.0
09-19 14:44:24.612 13394 17039 D TSLocationManager: [c.t.l.l.TSLocationManager a] 1888.4575
09-19 14:44:25.784 13394 13394 I TSLocationManager: [c.t.t.TSFirebaseProxy$4 onSuccess] 
09-19 14:44:25.784 13394 13394 I TSLocationManager:   ✅  Firestore INSERT: 77ed95bf-aa6c-459a-8a06-60fcf8a1cade -> 57HjpvnNEFVmIXhOFyaC
09-19 14:44:51.094 13394 13394 I TSLocationManager: - onPause
09-19 14:44:54.397 13394 17992 I TSLocationManager: [c.t.l.geofence.GeofenceService onHandleIntent] 
09-19 14:44:54.397 13394 17992 I TSLocationManager: ╔═════════════════════════════════════════════
09-19 14:44:54.397 13394 17992 I TSLocationManager: ║ Geofencing Event: DWELL
09-19 14:44:54.397 13394 17992 I TSLocationManager: ╠═════════════════════════════════════════════
09-19 14:44:54.397 13394 17992 I TSLocationManager: ╟─ 258aa359-80ef-b259-9811-11c77e168367
09-19 14:44:54.397 13394 17992 I TSLocationManager: ╚═════════════════════════════════════════════
09-19 14:44:54.447 13394 17992 D TSLocationManager: [c.t.l.l.TSLocationManager a] 10.0
09-19 14:44:54.494 13394 17992 D TSLocationManager: [c.t.l.l.TSLocationManager a] 1910.2378
09-19 14:44:55.095 13394 13394 I TSLocationManager: [c.t.t.TSFirebaseProxy$4 onSuccess] 
09-19 14:44:55.095 13394 13394 I TSLocationManager:   ✅  Firestore INSERT: 8bc5e993-a157-4048-8acb-8b912cc5a4d5 -> puZcY311Iykqhk6h7ulT

Are you using Firebase Functions? are you checking for errors? You're aware the schema of a posted geofence is the same as a location with added geofence property?

invention7 commented 5 years ago

OH! I see the data now, but it's in the 'locations' collection. I thought the expected behavior was to create a separate 'geofences' collection, per

bgGeoFirebase.configure({ locationsCollection: 'locations', geofencesCollection: 'geofences' });

christocracy commented 5 years ago

I don't see anything on my end that would geofences to be sent to locationsCollection.

invention7 commented 5 years ago

Hmmmm.

I've tried renaming the locations collection to what I thought would be an invalid path and see if we got errors from the plugin:

gGeoFirebase.configure({ locationsCollection: 'invalid#$%', geofencesCollection: 'geofences' });

both location and geofence events appear in the new collection:

screen shot 2018-09-20 at 7 37 26 am

I uninstalled the plugin and reinstalled using github as the package source instead of npm.
Same result...

Do you have any other routes I could test?

Thanks.

christocracy commented 5 years ago

Do you have any Firebase Functions running?

invention7 commented 5 years ago

I do, on my other collections. Nothing touching the collections in question.

invention7 commented 5 years ago

If I throw valid collection paths at it: bgGeoFirebase.configure({ locationsCollection: 'locations', geofencesCollection: 'geofences' });

I get both geofence and locations events written to the 'locations' collection

If I set an invalid geofences path: bgGeoFirebase.configure({ locationsCollection: 'locations', geofencesCollection: 'geofences/invalid' });

logcat acknowledges

09-20 08:05:20.588 21662 22279 I TSLocationManager: ℹ️ [Firebase] - configure: {"locationsCollection":"locations","geofencesCollection":"geofences\/invalid"}

But the same behavior occurs : all data is written to 'locations'

If I give it an invalid 'locations' path: bgGeoFirebase.configure({ locationsCollection: 'locations/invalid', geofencesCollection: 'geofences' });

adb logcat shows the configuration occur, the license warning (because I'm running w/o one currently in Android debug) and then the plugin goes silent... no more INSERT lines...

invention7 commented 5 years ago

If I ommit the config altogether:

bgGeoFirebase.configure();

I am seeing location events written to the 'locations' collection, but no 'geofence' events written at all. Looking at the log (attached), I don't believe I'm seeing the plugin attempting to write the geofence ENTER events.

log.txt

invention7 commented 5 years ago

Don't know if it's relevant, just, again, making notes in investigation:

adb logcat above states :

TSLocationManager version: 2.12.22 (278)

I'm certain I'm running the latest. (as we discussed earlier in the thread, I was running 2.12 from npm and updated to 2.13+ to hook to this new plugin. I'm now pulling straight from github master branch. I have hosed platforms/ and plugins/, then started over with a clean add platform, still seeing this 2.12.22).

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 5 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.