Thanks guys for your good advice and info. I'm developing a tourist app for an island which in part aims to measure ferry queue waiting time and parking congestion at three locations. The geofence feature would seem to be the best solution if I can get it to work reliably..
I did some tests this morning using my house as the location in the example geofence app and driving a few hundred metres away and returning (in Release (obfuscated) mode). These are the results:
1. app left open all night and other apps opened in the morning - fail
2. app opened and visible - success
3. app open but then sent behind another visible app - fail
4. repeated 2 but behind lock screen - success
I habitually "close all" recent apps and if this is the same as self-kill then it seems I will have a problem, together with a user cohort that may have the same habit. In any case, at least on my phone, the example app only works if it is visible.
I have got background geofencing to work by converting the GeofenceService to a foreground service that is scheduled to run daily from 6 am to 9 pm (covering the ferry operating hours) - after working on these issues months ago (it's taken me that long to raise the problem here!). However this is a relatively clumsy approach which brings out all the people worried that I'm tracking their activities - nevermind that I say explicitly in the app that I'm not, and only counting the presence of their phone in three specific locations with no personal info - they still don't believe me...
The Google info at
https://developer.android.com/training/location/geofencing.html talks about using a broadcast receiver with a manifest entry - which I may research further but Erel's and DonManfred's comments suggest that may not work for all users either...