tjanson / WifiLocationLogger

Android application for logging Wifi signal strength by location
32 stars 10 forks source link

Display measuring points #16

Open Frief84 opened 9 years ago

Frief84 commented 9 years ago

It would be nice if you could see the measurement points of your current Log within the app on a map ...

tjanson commented 9 years ago

Yes, I’ve thought about this, and maybe this could be achieved by simply adding an HTML view of the local version of the Leaflet map? This might even result in an almost live map as you log. Embedding an HTML like that should definitely be possible.

Alternatively, the Google Maps API allows adding markers for GeoJSON points etc. too.

Worth exploring in the future.

lingz commented 8 years ago

Hi, it says in the README that a map visualization has been done. Is it possible to see any working code for this?

tjanson commented 8 years ago

Yes, I did put something together with Leaflet, resulting in a "hex bin map", i.e., the RSSI is averaged over hexagonal tiles. (If you speak German, here’s the forum thread where all this originated.) It looked like this:

sample hexmap image

It wasn’t much more than a proof of concept. Here’s a downloadable version (.zip); the HTML file contains an explanatory comment.

(There was a server component too, which allowed uploading the logs from the app. I might still have it somewhere, but it was just some script.)


The thing is – and I guess I should eventually type up a post-mortem and post it in this project’s README – the results where underwhelming. At least for the original purpose, which was mapping the wifi coverage of a community wifi project.

lingz commented 8 years ago

Thanks for this info!

I'm about to make something similar for my community. I'm interested specifically in the power saving issues you ran into. Would you be able to briefly describe them and any workarounds you tried? Might be able to save myself some headache.

tjanson commented 8 years ago

Unfortunately I don’t remember much of the details. I should say that this was my first (and so far only) foray into Android programming, so it’s entirely possible that the problems would be easily solvable to an experienced Android programmer.

The general problem was that wifi scanning and/or logging to file would stop when the screen is turned off or a different app takes the foreground (#1). AFAIK there no way to guarantee that an Android activity/service stays running (even if that is clearly what the user desires).

I tried acquiring a wake lock as seen in this commit, and the scanning/logging was moved to a service (this PR, but it’s possible that either of this was somehow done incorrectly. We still had users report that the log was incomplete or stopped entirely.

lingz commented 8 years ago

So I built my own monitor and you can solve this by pushing the wifi scanning to a Service that is run as a foreground service. It will have a persistent notification and a very high priority so Android will not clean it up.

See here:

https://github.com/lingz/NetworkMonitor/blob/master/android/app/src/main/java/com/networkmonitor/NetworkMonitoringService.java#L137

tjanson commented 8 years ago

Cool! Are you logging to DB only? I see you integrated a speed test too.

Out of curiosity, what will you use this for?

lingz commented 8 years ago

I'm logging to a firebase instance. I'm running a network performance evaluation of the university wireless network.