Take a look at Google Play Location Samples
Location Updates using a Foreground Service: Get updates about a device's location using a bound and started foreground service.
Location Updates using a PendingIntent: Get updates about a device's location using a PendingIntent
. Sample shows implementation using an IntentService
as well as a BroadcastReceiver
.