I am creating an Android Class library that makes calls to an internal REST API and also utilizes Android's Geocoder class (specifically getFromLocation()) which requires Context. I was planning on making the library an IntentService to allow for it to be run asynchronously, but I can't figure out how to handle Context (the GeoLoc call is in a separate class that is part of the library that the IntentService calls).
My question is, how do I obtain context necessary to instantiate android.location.Geocoder from within an IntentService?
Every Service
is a Context
. You can use this
or getApplicationContext()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With