[android-developers] Re: why am I receiving location updates without WakeLock if the device is put to sleep?

2012-05-11 Thread ste1024
Am Mittwoch, 9. Mai 2012 16:11:56 UTC+2 schrieb Nadeem Hasan:

 Your phone is using wifi as the location source. If wifi is set to stay up 
 during phone sleep, LocationManager will continue to provide updates unless 
 you remove your location update subscription in onSuspend().


I tried the same this time with disabled WIFI, using the GPS location 
provider instead, and I also continued to receive location updates during 
sleep.

So does the location provider subscription keep the CPU awake all the time 
or only during certain intervals when it tries to get a location fix?

The LocationManager 
documentationhttp://developer.android.com/reference/android/location/LocationManager.htmlis
 rather vague on that, it only mentions something like that in the 
documentation for 
public void addProximityAlert (double latitude, double longitude, float 
radius, long expiration, 
PendingIntenthttp://developer.android.com/reference/android/app/PendingIntent.htmlintent)
 :

 In case the screen goes to sleep, checks for proximity alerts happen only 
 once every 4 minutes. This conserves battery life by ensuring that the 
 device isn't perpetually awake. 

However, I am not using that function, and also I get uptates as often as 
once per minute.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] When using LocationManager.requestLocationUpdates, do I need a WakeLock?

2012-05-11 Thread ste1024

Am Sonntag, 10. Oktober 2010 23:50:35 UTC+2 schrieb Mark Murphy:

 I strongly suspect that you need to hold a WakeLock for as long as you
 are seeking fixes. I am not aware that any location provider has the
 ability to wake up the device.

Sorry for digging up this ancient topic, but an trying to find an answer to 
the same question.
In my app so I am able to receive location updates even if I put the device 
to sleep, without explicitly holding a WakeLock.
I came across what appears to be the Android 2.2 source of the 
GpsLocationProviderhttp://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/com/android/internal/location/GpsLocationProvider.java/?v=source,
 
and assuming I did not misinterpret the code, it looks like it is really 
able to wake up the device via the AlarmManager.

Can anyone confirm this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: why am I receiving location updates without WakeLock if the device is put to sleep?

2012-05-10 Thread ste1024


Am Mittwoch, 9. Mai 2012 16:11:56 UTC+2 schrieb Nadeem Hasan:

 Your phone is using wifi as the location source. If wifi is set to stay up 
 during phone sleep, LocationManager will continue to provide updates unless 
 you remove your location update subscription in onSuspend().


How is WiFi configured to always stay up during sleep? Is the mere fact of 
someone listening for location updates enough or is there some device 
setting for this?
And how would the situation be if WiFi was turned off and GPS or network 
provider via cell network would be used?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: why am I receiving location updates without WakeLock if the device is put to sleep?

2012-05-09 Thread ste1024


Am Dienstag, 8. Mai 2012 13:22:04 UTC+2 schrieb lbendlin:

 your location provider is network. Network means WiFi or cellular.  One of 
 the two is on while the device is asleep, and possibly you have another 
 application that uses location updates (so you may be getting them 
 passively)


I have a strong suspicion that the Google Maps app is the culprit here.
When I reboot the phone and check the running services (before even 
starting my app), I see that NetworkLocationService of the Google Maps app 
is running. That app cannot be uninstalled, btw., at least not on my device 
- I can only uninstall updates.

Btw. I have found an solution for my second question here: 
https://github.com/commonsguy/cwac-locpoll

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: why am I receiving location updates without WakeLock if the device is put to sleep?

2012-05-09 Thread ste1024
Unfortunately shutting down the Google Maps app (which killed the running 
service) did not help. After doing that, starting my app and pressing Power 
to go back to sleep, I still got location fixes.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] why am I receiving location updates without WakeLock if the device is put to sleep?

2012-05-07 Thread ste1024
In developing an app that needs to get periodic location fixes, I ran 
across several issues that are unclear to me.

The application currently does not use any WakeLocks.
Yet even if the device is put to sleep (e.g. via pressing the power 
button), I seem to be able to get location fixes.

I have built a counter into the app that increments on each location fix.
I reset the counter, press the power button power to put the device to 
sleep, move it to a differen location and let it sit there for several 
minutes.
After several minutes I come back, wake up the device and check the 
counter. And it often is not zero, but shows that multiple location updates 
were received while it was supposed to be sleeping.

Location provider is network, update distance and interval are 1 meter / 1 
minute.
The device (HTC Desire HD with Android 2.3.5) has no SIM card. WiFi is 
enabled and the device is _not_ connected via USB
(USB debugging is enabled, though).

So my first question is: why does this happen without a WakeLocks being 
held?

Also on the topic of WakeLocks, assuming the first issue has been cleared 
up and I really have to use WakeLocks:
Can I have something that periodically wakes up the CPU to get a new 
location fix, keeps the device awake while we try to get the fix
(or until a max. timeout has been reached), then goes back to sleep, then 
wakes up later, gets the next fix, sleeps, etc.?
Or do I have to hold the WakeLocks all time (which I can imagine has 
adverse effects on battery life)?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en