Reputation: 10341
i have alarm that calls my intentService every 15 min, in the intentService how could i get the device location? (note: i have a wakeLock in my intentService)
Upvotes: 1
Views: 1715
Reputation: 1007359
You are welcome to try getLastKnownLocation()
, but it is likely that it will be null
. And an IntentService
cannot wait around for some location fix to arrive.
Rather, you need a regular Service
, crafted to handle this scenario. I created one (LocationPoller
), which another developer has improved upon.
Upvotes: 2