cgeo / cgeo

c:geo - The powerful Android geocaching app.
www.cgeo.org
Apache License 2.0
1.4k stars 567 forks source link

Problem re-activiting GPS after longer phone sleep #3586

Closed rsudev closed 10 years ago

rsudev commented 10 years ago

From the German geocaching forum (translation by me): My current observation is, that after the phone has been in sleep-mode for a longer time, c:geo is not able to re-activate the GPS. Neither the new location symbol from Android nor the GPS symbol is shown. After stopping and re-starting c;geo it works again. (Android 4.4, cyanogenmod 11, HTC one, c:geo NB from 27.01.2014 probably)

(Original text from http://forum.geoclub.de/viewtopic.php?p=1154170#p1154170): Allerdings, nach meiner bisherigen Beobachtung, wenn das Handy offensichtlich längere Zeit im Sleepmodus war, kriegt c:geo GPS nicht wieder aktiviert. Weder das neue Lokalisationssymbol von Android noch das GPS-Symbols eines GPS-Tools erscheint dann wieder in der Statusleiste. Der Workaround geht folgendermaßen: c:geo abschießen und neu starten, danach funktioniert GPS auch wieder.

yellowduck commented 10 years ago

I have had something similar happen to me since I updated recently. Currently using 2014.01.22-NB-2f53dd8. Using a Note II Android 4.3. I have to restart c:geo to get GPS location working. I am not sure it is to do with the amount of sleep time, however, I have not yet determined a cause.

SammysHP commented 10 years ago

Maybe related to changes from @samueltardieu.

samueltardieu commented 10 years ago

@rsudev On NB or on release?

rsudev commented 10 years ago

Nightly - edited description accordingly.

samueltardieu commented 10 years ago

Don't hesitate to add precisions if you know how to reproduce this.

Lineflyer commented 10 years ago

I tried to reproduce but currently fail to do so. What is the meaning of "sleep mode"? Display switched off while c:geo is active or something else? How long is "a longer time" round about? I tried 10 minutes and everything was OK.

yellowduck commented 10 years ago

The symptom is that despite c:geo being active, the GPS is not, and hence you cannot get a location.

samueltardieu commented 10 years ago

Yes, I think we get the symptoms, but how do you reproduce this?

Cotta-R commented 10 years ago

I'm the one, who reported this in the german forum (see first post). Meanwhile I updated to the nightly build on 29.1.2014. My device is a HTC One, which I just rooted and installed CyanogenMod 11 and the teaMSeven kernel. With stand by or sleep mode I mean, that the device is "switched off" with just a short press at the on/off-button.

The GPS-receiver doesn't get activated sometimes. Unlike the first times, where it happened after a long time of stand by of the device (hours or over night), this also happens just after short times of stand by (a few minutes). As I said, it helps to kill and restart the app, but sometimes it's necessary to repeat this 2 or 3 times.

I'm sorry but I don't know how to reproduce this, it sometimes just happens and sometimes not. I'll report back, when I notice something more specific.

Lineflyer commented 10 years ago

An important information would be, if you can remember which screen/function of cgeo was active to that time.

Von Samsung Mobile gesendet

-------- Ursprüngliche Nachricht -------- Von: Cotta-R notifications@github.com Datum:31.01.2014 21:31 (GMT+01:00) An: cgeo/cgeo cgeo@noreply.github.com Cc: Lars gc@droescher.eu Betreff: Re: [cgeo] Problem re-activiting GPS after longer phone sleep (#3586)

I'm the one, who reported this in the german forum (see first post). Meanwhile I updated to the nightly build on 29.1.2014. My device is a HTC One, which I just rooted and installed CyanogenMod 11 and the teaMSeven kernel. With stand by or sleep mode I mean, that the device is "switched off" with just a short press at the on/off-button.

The GPS-receiver doesn't get activated sometimes. Unlike the first times, where it happened after a long time of stand by of the device (hours or over night), this also happens just after short times of stand by (a few minutes). As I said, it helps to kill and restart the app, but sometimes it's necessary to repeat this 2 or 3 times.

I'm sorry but I don't know how to reproduce this, it sometimes just happens and sometimes not. I'll report back, when I notice something more specific.

— Reply to this email directly or view it on GitHub.

yellowduck commented 10 years ago

I've had it happen again a few times over the weekend. It appears to occur when the map is active, and the phone is toggled 'off' for a while. Upon restart, the GPS is no longer active, and c:geo needs to be killed and restarted. I also used the navigate(driving) option, although I cannot say that it is related to that function (google maps).

Cotta-R commented 10 years ago

When I tried to reproduce the bug I always failed. But the issue happens from time to time. Meanwhile I got it two times, when switching the phone on, unlocking the lock screen and then the map screen of c:geo was on the screen and GPS was off, so same as yellowduck. I don't know, if it happens under different circumstances as well. But I got some more problems with GPS lately: While storing caches offline, the location service was toggled off and on a a rate of probably 1 Hz, and when finished, GPS was not working in c:geo. Furthermore it happened a few times, that GPS stopped working in c:geo without having the device in sleep mode. I was just walking around with using the map screen and noticed, that the pointer wasn't moving anymore, only turning from the magnetic sensor. Solution (as always): kiling the app. Version: still from end of January.

SammysHP commented 10 years ago

the location service was toggled off and on a a rate of probably 1 Hz

The blinking icon in the notification bar means that it tries to find a position.

Cotta-R commented 10 years ago

the location service was toggled off and on a a rate of probably 1 Hz

The blinking icon in the notification bar means that it tries to find a position.

I think this was changed in Android 4.4. The old gps-icon doesn't exist anymore, it's now an icon looking little bit like the marker in google maps, and this one is displayed whenever location service is used, regardless if a GPS-fix is available or not. To help this issue I installed a small tool, which brings up another icon displaying the status of the GPS.

samueltardieu commented 10 years ago

While storing caches offline, the location service was toggled off and on a a rate of probably 1 Hz, and when finished, GPS was not working in c:geo.

Interesting. Did you store the caches offline from the map or from the list activity?

Cotta-R commented 10 years ago

Did you store the caches offline from the map or from the list activity?

I stored the caches from the map. I just tried again. When I stored caches for the first time, GPS was switched off and back to on when finished (this seems to be the normal behaviour), when I stored more caches the on-off-effect of the location service happened again. Toggle rate is probably much faster than 1 Hz unlike I wrote before.

samueltardieu commented 10 years ago

Can you try again with tomorrow's nightly? We no longer turn the GPS off, I'd be interested to see how that changes things.

Cotta-R commented 10 years ago

I just tried with the latest nightly version. The issue with toggling GPS did not occur so far.

But the problem with not reactivating GPS is still valid. It happened as following: I was waiting in the mapscreen to get the caches there displayed. As this took too long I got bored, switched to the homescreen, then to the play store, downloaded and starting an app and after 5 or 10 minutes, the phone wasn't switched off meanwhile, I went back to c:geo, the map was updated with the caches, but the location service was gone.

Lineflyer commented 10 years ago

With the new nightly the problem of not reactivating GPS after resume just started for me. I experienced this several times today but had no problems with the last nightly and before. For me it got worse.

samueltardieu commented 10 years ago

@Lineflyer It is great that you can reproduce it, it means that we will be able to fix it (as soon as I can reproduce it myself). I'll remove the Unverified label.

samueltardieu commented 10 years ago

@Lineflyer @Cotta-R @yellowduck When you say that you come back to c:geo after a while, does that mean that you start c:geo from the launcher or, as I suspect, you go back to the activity you were in through the "recent applications" menu (the one showing screenshots)?

Cotta-R commented 10 years ago

I'm sorry, but I'm sure I didn't use the recent applications menu (I almost never use it), when the issues with gps occured. Usually I (re-)start it from the homescreen, and if it still was in background, the app starts up with the last activity.

samueltardieu commented 10 years ago

Ok, thanks for the precision.

Lineflyer commented 10 years ago

I think we have to set the Unverified label again, as I am no longer able to reproduce up to now. The occurence I had a week ago seems to have some special circumstances or usage scenario I can no longer reproduce. @Cotta-R @yellowduck If you have more luck finding a reproducible step-by-step instruction to get this problem, please let us know.

rsudev commented 10 years ago

Yesterday I was out caching and did use the phone GPS (normally I use my external BT-GPS). Here I made the observation, that the GPS was not activated at all in the first place, even when on the live map! After going into cache details and coming back to the map, the GPS was kicking in. Unfortunately I cannot reproduce this today anymore, so its more of an indication that there is sometimes something amiss.

yellowduck commented 10 years ago

I am using NB from 10-Feb eef6a6. I have periods when I can go for a long time without this effect occurring, yet on the other hand it can happen almost straight away. One action that I do use regularly is Navigate->Driving (using Google Maps). I have noticed that this effect can occur after that, but again, it is not consistent. Rest assured, if I can reproduce it, I will post something here. (On another note, I am finding the maps more unstable than previously - I don't think it is related to this issue, but should be considered).

SammysHP commented 10 years ago

Your version is too old.

Lineflyer commented 10 years ago

This seems to be a nasty bug. While I wrote some time ago, that the fault was showing up more often, I can now no longer see any problem. I will keep on looking for this, however @yellowduck If you get some new clues with a newer nightly build please let us know.

samueltardieu commented 10 years ago

Since then, some logic and the RxJava version have been updated.

Lineflyer commented 10 years ago

There is someone on support mail with a similar problem but the other way around. He said GPS stays active if he puts the phone to sleep and afterwards, just stops c:geo usage (i.e. the task is in background). I asked for more details.

Lineflyer commented 10 years ago

@yellowduck Any new observations regarding this issue? Please test again with the newest nightly build.

I still can not reproduce this and the user from support mail I mentioned above did not provide feedback until now.

yellowduck commented 10 years ago

Thanks Lineflyer for the nudge. I am currently using 2014.03.01-NB-ae8b55b and I am still experiencing the problem. It is intermittent, and it also takes different amounts of time to manifest itself. For example, I walked a whole series of 20+ caches without it happening, and I have also had it happen three times within a very short period of time.

I use c:geo predominantly in offline mode (maps and stored caches). The common factors that I have at the moment are either the use of google navigate or the use of live data when in map mode.

google navigate: I use the map to identify a cache I want to visit. Select the cache on the map, menu button -> navigate (driving). After arrival at destination, back button to return to the map.

online data In map view, enable live data so that I can see caches nearby that I may have stored in other lists.

The issue always happens after the phone waking up.

yellowduck commented 10 years ago

After writing all of the above, I have just picked up my phone, doing neither of the two things mentioned, and there is no GPS activity - the implication being it is something that happens when the phone goes into standby mode.

samueltardieu commented 10 years ago

This is really strange, as I have never managed to reproduce this no matter how hard I tried.

marco-dev commented 10 years ago

Is there maybe an app service in background working if mobile is standby? Ringtone loudness due to gps position? Weather app updating by gps pos every hour?

rsudev commented 10 years ago

I have another strangeness on my phone that I can add to the mix. I just switched on my GPS while still being at home in WLAN (and having location service through WLAN enabled). Starting c:geo, the GPS localization was not triggered (no blinking symbol in status bar). Right now, about 10min later, I re-executed the same sequence - GPS was started. I observed this also once in the 'wild' one and a half weeks ago - will try to capture a log for this later today (if timer permits).

Lineflyer commented 10 years ago

Is there maybe an app service in background working if mobile is standby? Ringtone loudness due to gps position? Weather app updating by gps pos every hour?

This would also be my next idea. @yellowduck Are you aure there is no other app in the background taking control over GPS.

SammysHP commented 10 years ago

No app can "taking control over GPS", only Android itself. After resume from standby c:geo should tell Android that it wants a GPS position, no app can prevent this.

samueltardieu commented 10 years ago

@SammysHP Exactly!

(except if an app disables the GPS completely, but I don't think this is possible without root access)

marco-dev commented 10 years ago

@yellowduck Is your phone rooted?

yellowduck commented 10 years ago

No. Samsung Note II (N7100), sim free.

Lineflyer commented 10 years ago

@yellowduck You are not living in Germany or Slovenia, are you? Would be helpful for an offline troubleshooting.. The most important thing now is to find a reproducible scenario (or at least an information on which part of the c:geo app it happens).

mucek4 commented 10 years ago

If it's not a secret, tell us an aprox. location.

Cotta-R commented 10 years ago

I still have the issue as well. The version I installed is from 07th march. The problem with GPS manifests in various ways. Most common is, that there is no GPS after a while of stand by of the mobile. But sometimes it happens, that during the map view GPS still seems to be on, but the position doesn't change anymore. I still can't tell any way to reproduce it. My device is a HTC One, rooted, with Cyanogenmod, and I'm from Germany. Mobile network is always off, I have only a SIM from Poland from my last holidays plugged in the device, which is not working in Germany and anyway probably not valid anymore.

samueltardieu commented 10 years ago

The next nightly (2014.03.13) will contain extra debugging information (you have to enable the debug info generation in the settings) to help identify the issue. Please provide us with a logcat dump tahen right when the issue arises (using, for example, the catlog application).

Lineflyer commented 10 years ago

There is something I dont understand with this debug information.

In this sequence I started c:geo from homescreen (it was active before...therefore the counter is >0) and then just opened the saved caches list. GPS stayed active all the time (as it should be), but still I see a lot of log entries and the last one is a stop (what does not reflect the real status):

22:39:03.521 Info cgeo 27854  Starting cgeo.geocaching 30140312 a.k.a 2014.03.12-NB-0933e9c
22:39:03.630 Debug cgeo 27854  GeoDataProvider: starting the GPS and network listeners (16)
22:39:07.889 Debug cgeo 27854  GeoDataProvider: registering the stop of GPS and network listeners in 2.5s (16)
22:39:08.108 Debug cgeo 27854  GeoDataProvider: starting the GPS and network listeners (17)
22:39:08.108 Debug cgeo 27854  GeoDataProvider: registering the stop of GPS and network listeners in 2.5s (17)
22:39:08.108 Debug cgeo 27854  GeoDataProvider: starting the GPS and network listeners (18)
22:39:08.108 Debug cgeo 27854  GeoDataProvider: registering the stop of GPS and network listeners in 2.5s (18)
22:39:08.326 Debug cgeo 27854  GeoDataProvider: starting the GPS and network listeners (19)
22:39:10.401 Debug cgeo 27854  GeoDataProvider: stopping the GPS and network listeners (16)
22:39:10.619 Debug cgeo 27854  GeoDataProvider: stopping the GPS and network listeners (17)
22:39:10.619 Debug cgeo 27854  GeoDataProvider: stopping the GPS and network listeners (18)
Lineflyer commented 10 years ago

btw: I just triggered a manual NB build as NB 2013.03.12 failed to build last night. If something needs to be corrected you can do it by commiting before 00:30 MET and it will be contained in the nightly 2014.03.13

yellowduck commented 10 years ago

Sorry folks, I was out all day yesterday and only just back online. i am based in the UK. I will download the new nightly build and enable logging. Regards.

Cotta-R commented 10 years ago

I installed 2014.03.13-NB-62d398f, enabled logging in c:geo, and I learned, that all logging output goes into the syslogs, right? So I installed LogCollector (and another similar tool), but I cannot find any output at all from c:geo in any log. I believe, there should be some messages in Info and in Debug, right? Anyway, so far the gps-issue didn't happen, but I had not that much time to play around. Just in case there were changes between the build of 2014-03-07 and the one from 13th march.

marco-dev commented 10 years ago

You can use aLogcat app and set filter to cgeo to view system log output.