Reputation: 10016
getSystemService(LOCATION_SERVICE) returns a LocationManager.
I want the same functionality but for com.google.android.gms.location.LocationClient.
Does something like this exist?
Upvotes: 0
Views: 185
Reputation: 1006674
Does something like this exist?
You do not obtain a LocationClient
via getSystemService()
. You obtain a LocationClient
via the LocationClient
constructor.
Because I am writing a BroadcastReceiver to handle a broadcast Intent and I want this BroadcastReceiver to use the same LocationClient instance each time it is called.
If your BroadcastReceiver
is registered via registerReceiver()
, you are welcome to hold onto the instance of LocationClient
for as long as the hosting component (activity or service) is active.
If your BroadcastReceiver
is registered in the manifest, your process can be terminated between broadcasts, and so there is no means for you to ensure that you get the same LocationClient
instance.
Upvotes: 1