Thanks for the info and link - it's very useful.
However, I still don't understand what's the bottom line for my use-case.
I'm writing an app that samples GPS, accelerometer and other data in certain times/locations, e.g., whenever I'm home, at the office or in my car. I'd like the app to start sampling automatically (ie, without having to manually start the app), so I thought it could wake up whenever one of the following relevant events occurs: my home wi-fi or a bluetooth device in my car are detected; my location changes by more than X meters; the accelerometer records a value larger than Y; etc. Once it starts sampling, the app could determine by itself when it should stop sampling (until the next relevant event occurs).
So... is this possible?
Another option is to have the app continue sampling all the time, from the moment the phone is turned on. This shouldn't affect user experience, since the sampling rate would remain low most of the time (eg, once every several seconds/minutes). The app could change the sampling rate based on the location, existence of wifi/BT connection, etc. Is this option possible / recommended?
Thanks again for your advice!