transistorsoft / cordova-background-geolocation-SampleApp

Cordova Background Geolocation Sample Application
https://www.transistorsoft.com/shop/products/cordova-background-geolocation
MIT License
121 stars 78 forks source link

Android - checking sample app #75

Open dda-vasavi-yerapotula opened 7 years ago

dda-vasavi-yerapotula commented 7 years ago

I took a test drive and added some fences in the sample app and noticed different color circles. what does green circle, light grey circle and light pink circle means in Android?

christocracy commented 7 years ago

Green = no transistion event fired yet Grey = transition event fired Pink = stop point (not a geofence)

The geofence event callback interacts with google maps API to change the color. That proves the JavaScript event callback fired.

dda-vasavi-yerapotula commented 7 years ago

Ok thanks for the explanation.

I tested the below scenarios in samsung (added fence from point A to Point B) 1) tested when app is running in foreground - able to see grey circles (transition fired) 2) when app is killed in android and after I reached point B - I see only green circles

what does this indicate?

christocracy commented 7 years ago

It's important to understand that when you terminate the app, you terminate ALL JavaScript.

When you boot the app again, all the circles are redrawn in their initial state (green).

dda-vasavi-yerapotula commented 7 years ago

Ok Thanks for the information. How will I know it crossed the fence when app is killed in the background as I don't get any additional notification in android and I see only green circles when application open

christocracy commented 7 years ago

The plugin's database still contains all those recorded locations and geofence events.

If I wanted to, I could re-apply the geofence transition states of by querying the plugin database (assuming those locations hadn't been synced to server yet)

christocracy commented 7 years ago

With debug: true, you will hear "beep-beep-beep"

That location associated with the geofence event has been persisted to the plugin's database.

If an URL is configured and the server reachable, the plugin could immediately post each geofence event to the server.

dda-vasavi-yerapotula commented 7 years ago

Oh I see. Any idea why android doesn't notify when fence exits/enters where as I get nice notifications in IOS

christocracy commented 7 years ago

Because I chose not to. You will hear sound fx

dda-vasavi-yerapotula commented 7 years ago

Yes I do hear some sounds. we are still having trouble getting it to work in Android when our app is killed and I am trying to test if sample app works fine in Android. Thanks for your help

christocracy commented 7 years ago

Getting what to work? You understand that all your JavaScript will not run when app is terminated, right?

If you're hoping to show a notification from geofence event when app is terminated, you can't do that with JavaScript.

In sample App, try setting forceReloadOnGeofence: true then terminate the app.

Drive into a geofence. App will launch.

dda-vasavi-yerapotula commented 7 years ago

Ok I will try this in sample app and see tomorrow. Thanks

christocracy commented 7 years ago

If I were you, I would forget about local notifications and send push notifications from the server instead, whenever the plugin uploads a geofence event to the server.

dda-vasavi-yerapotula commented 7 years ago

Chris, we are sending notifications from server side only using AWS SNS.

christocracy commented 7 years ago

Ah, great then. Simply give the plugin an URL to your server. When you hear beep-beep-beep, you can be sure that geofence event has been posted to your server.

dda-vasavi-yerapotula commented 7 years ago

My team was saying it is not firing the geofence event after adding all the options. I will first try with sample app in android and will add some logging from our app itself. For some reason the same code has different behavior with Android and IOS