CaptainSpam/geohashdroid

Pending upload lost

Opened this issue · 6 comments

I was geohashing in 47 -119, apparently far from a phone network signal. I snapped photos and and added them using the "wiki" button, which showed an "upload is pending" message.

When I drove back into range of 4G/LTE, the upload remained pending.
When I connected to wifi, the upload remained pending.
I could see no way in the notification or the app to "nudge" that upload to start (or continue).

For another reason entirely, I restarted the phone after that, and the notification went away.

Related question - where are the modified photos stored on the Android device, so I can upload them using the web interface?

--Thom

Unfortunately, the modified photos are never stored on the device. They're entirely modified on-the-fly at upload time (which, as you found, will be delayed if there's no internet connection), with nothing written to storage other than the coordinate and expedition data and a reference to the original image, and only if the queue that manages that gets shut down early. If the upload never completed, there's nothing on storage to pick back up. You can blame that on me not wanting to keep things sitting around on the device taking up space by accident, I suppose, though that does cause problems in cases like these.

Depending on how the phone reboots (i.e. if it gives all the apps a clean shutdown first), it MIGHT still have the entry in deep storage once the wiki poster wakes back up. However, in hindsight, I now realize that while it should store that for later, I don't think I have any means of setting that back in motion, short of making a new wiki post and hoping the queue is restored with anything that was there before shutdown. If, however, the phone was hard-killed, the data might just be lost.

Though, what's disturbing me more is that the app apparently never got notified that your internet connection came back. As you can probably guess, it should try uploading again as soon as it sees any sort of connection, be it mobile or wifi. Since it stayed in the "pending" state, that tells me something went wrong there, and since I put that there specifically because Geohashing frequently takes people to remote areas with no internet (such as where you were), that's a bit I'd like to make sure works.

Something gives me the odd feeling that something changed in Android in recent versions. What version of Android are you using, by the way? I did test this a while back when I first wrote that feature, but since the IDE is complaining that this method is deprecated as per Android N, I might need to rethink how I do that check.

Regardless, you are also right in that the notification itself won't do anything when poked. I'll change it such that it manually tries to restart the queue when that happens, just in case it doesn't detect a connection again.

I'm afraid, though, that your post as it stands may be lost. Sorry about that. If, however, you make a new wiki post and it suddenly discovers and uploads the "lost" one, please let me know, as that would mean my serialization method worked properly, which would be really great, as that was quite annoying to test at first. :-)

Cap'n,

The version of Android is 7.0 (Nougat).

A test message did not flush out data - though I attempted one more geohash between the two.
I'll upload the pictures I took via web interface and not worry too much about it - wasn't able to reach the hashpoint due to a one months growth of wheat :)

Back to the bug - seems like we could turn off mobile data, bring up geohashdroid on wifi and then just walk away from the wifi source. Then try returning, turning on mobile data, or both.

--Thom

Nougat, you say... well, drat. Looks like it's specifically mentioned in the background optimization info page in the documentation that the way I'm doing it won't work anymore. Guess I'm definitely going to be fixing that, then.

I'll try to figure out how to integrate something like JobScheduler or ConnectivityManager stuff into what I've got, whenever I've got time. Hopefully that shouldn't take too long.

Thanks for reporting the issue, though!

Wow, glad this came up now. I just noticed that MediaWiki also changed the way logins work from the API, and that change would happen if the Geohashing wiki upgrades. I'd better get that fixed as well.

(I noticed this because I just upgraded my test wiki so I'm not spamming the real wiki with test posts)

Okay... I think what I've committed should do the trick. As far as I've been able to test with the emulator, it's properly waking up on Android N when the network connection returns. I'll probably run off a new APK this weekend and get it up on the Play Store, if nothing else goes wrong in the meantime.

There we go! Version 0.9.2.3 is now up on GitHub, and I just pushed it out to the Play Store. That should fix this as soon as the store tells you there's an update. Enjoy!