I know this is a very open question, but does anyone know how I can determine if a user is on public transport? Ideally, I'd have a background service running such that only subscribers who are on public transport receive my alerts.
how I can determine if a user is on public transport?
You ask the user, "Yo! You on public transport?"
Perhaps a fusion of maps data and sensors?
You can use the activity recognition portion of the Google Play Services location API to determine if the user is in a moving vehicle.
However, there is no requirement for governments to collect, let alone publish, the GPS coordinates of all public transportation vehicles. Hence, there is no way for you to determine the location of all the world's buses, trains, trams, etc. And, as a result, you have no way to determine if the user is on one of those.