DaylightingSociety / WhereAreTheEyes

Surveillance Detection and Mapping App
https://eyes.daylightingsociety.org
BSD 3-Clause "New" or "Revised" License
230 stars 18 forks source link

Cameras and marks not showing on map #58

Open GillesJ opened 5 years ago

GillesJ commented 5 years ago

I noticed that there are no cameras shown on my map when I went for a mapping walk today. None of the cameras I marked showed up either. It was a fresh install on Lineage OS 16 (Android 9). My location was shown correctly. Source is FDroid, current version.

milo-trujillo commented 5 years ago

This is... odd. The API has not changed, and the server seems to be responding to requests correctly with the iOS client. On Android, I see the same behavior as you. The logs complain that the position is NULL, despite the device clearly having location data and displaying the user position on the map.

milo-trujillo commented 5 years ago

This is definitively a problem in the Android code. Specifically, the error is in DownloadPinsTask.java:

// Here we round our GPS coordinates to gross approximations for anonymity
if( p.position == null ) {
    Log.d("GPS", "Position is null!!");
    return null;
}

This should only occur when the app is first starting and doesn't yet have position data, or if permissions are set wrong and prevent the app from getting location data. The data is sent from GPS.java:

    public void onLocationChanged(Location loc) {
        // If this is our first location update just prime everything
        if( position == null || lastKnown == null ) {
            Log.d("GPS", "Initial ping, downloading first pins.");
            position = loc;
            lastKnown = new Date();
            new DownloadPinsTask().execute(new PinData(new HashMap<LatLng, Integer>(), map, position));
            return;
        }

Which should... update the position as soon as we receive non-null location data, and then send a new HTTP request. Given that this has been working for years, and we have not pushed an update in quite some time, my guess is something has changed in the Android API or OS permissions system, so our approach is no longer correct.

milo-trujillo commented 5 years ago

The app is functioning correctly on at least some Android devices (@tfdahlin confirmed), so this may be vendor or OS-version specific. Just to confirm, can you check that location permissions for the app are enabled, restart the app, and verify that the cameras don't show up when you're zoomed out? This is obviously a bug no matter what, but perhaps it's poor handling of permissions changes rather than a flaw in the area of code I highlighted.