GPS can't be activated while sleeping?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

GPS can't be activated while sleeping?

Postby moderating » Wed Mar 25, 2009 2:06 am

hi everyone,
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?
moderating
Freshman
Freshman
 
Posts: 2
Joined: Wed Mar 25, 2009 1:50 am

Top

Postby androooooid » Tue Aug 04, 2009 12:32 am

This is interesting. I think I am running into the same issue. Anyone know what's going on?
androooooid
Junior Developer
Junior Developer
 
Posts: 17
Joined: Fri Sep 26, 2008 8:47 pm

Postby MOnline » Sun Sep 27, 2009 10:08 pm

Hi androooooid and moderating,

I have experienced the same problem (i wanted to keep gps running even when the program was asleep). The way I did it (what seemed to work) is creating the LocationManager and LocationListener in a service. I created a variable to contain the distance traveled and stored that in my service 2. As soon as I receive a start signal I start updating my traveled distance value. (so even when the phone turns to sleep mode (red button) my service continues running (even tho the application is paused)).

Small note be sure to disconnect listeners when the stop signal is given (else the gps will be always on).

Kind regards,

MOnline
MOnline
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Sep 21, 2009 9:51 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests