i made an application which lunched a service running background. when the service started, it registered a LocationListener to the LocationManager, the trigger distance is 100m. I want the listener always be functional even if phone is sleeping, so i acquired wave lock in the service's lifecycle ( acquired on start and released on destroy).
but i found while the phone sleeping (i clicked the red button), the listener is never triggered even if i moved very long distance. LocationManager didn't invoke listener untill i activate the phone manually!
i checked the phone'a awake time(settings - about phone - status - Awake time) to ensure application got the wave lock. i found the awake time is 100% during the application running. so i think application got wave lock properly.
anyone knows something about this? Even full wave lock can't keep the GPS on? Is there any way can keep listener active? thanks alot
BTW, i also tried AlarmManager, set a alarm when starting, and the receiver will acquire a full wave lock and then sleep some seconds to wait for LocationManager getting the position and to invoke my listener, and then the receiver will schedule itsefl in some minutes. But my listener never triggered though the receiver works well. Maybe the LocationManager or GPS didn't be activated? is there any way to perform that?