I use "time recording pro" to keep track of my billable and volunteering time, it's a great app if you need anything like it. Developer was responsive in the past and integrated a feature upon request. Normally the app pulls the location (converted to an address) when you make a time entry, and inputs it to the entry notes.

Since switching to GrapheneOS I'm getting location errors. If I go into the app and hit retry a few times it'll usually pull coordinates, but not every time.

The second quirk is that in the past it would convert (somehow) the coordinates into a nearby address. This aspect never works anymore.

Can anyone give an input on why the location would be not consistently working for this app? And second, and idea why it won't figure out what the address is when it does pull coordinates?

I'm planning to reach out to the dev, but wanted any insight from the OS side of things to help them to figure out options.

treequell I haven't had any other issues with apps that use location. I.e. mapping and navigation apps.

I do get a little "location" icon in the corner of the screen when I make an entry, but I still have the error. When I got into the app and hit retry I'll usually get coordinates and it says 18m, so it it's getting a decent lock.

I went through the process to use Google's location services just now, and it doesn't seem to make a difference.

Is there some sort of delay and maybe the app times out of it doesn't get an instant response?

When the app is requesting location it gives a notification for a few seconds before switch to the "cannot obtain..." notification. It doesn't seem to matter how many times I try to make a new entry from the app but it will throw the error. It's when I go into it's menu and hit the refresh button that it pulls the coordinates with moderate accuracy.

The only thing I can relate this to is the issue I have using Google maps. I can never get a good fix on my location. I've been told it's because graphene doesn't use googles network of wifi devices in addition to the GPS satellites.

What I have found that work is when I'm outside I use the "GPS test" app which seems to provide a good lock on my location. Then I open Maps and it knows where I am and the app functions normally.

Maybe give gps test app a try.

11 days later

Ok, so I relayed info to the app developer and they were quite helpful in providing insight, although we still don't know why it isn't working.
The following is his response.

hi,
that's a tricky one. 
a) i've only ever seen this type of error if any of the Android System settings say "you cannot use 'Location'". on my Pixel 6 that's the system settings toggle "Location / Use location".
b) what likely makes things more complicated: my app is executing the location lookup in a service; while this is marked as "ForegroundService", it technically still runs in the background. Graphene OS might consider this a "location access in the background" when triggered via my app's notifications or widgets, and therefore block it based on additional security features.
c) that other issue (you get geo coordinates but not address names from within the app): cannot pinpoint this neither. most likely explanation: the call to the google "address lookup" is blocked (this is wrapped in google libraries, but ultimately they do look it up at runtime via webservice call against their servers)

so, long story short, i cannot tell you why this happens. 
also, just in case, these are the library calls i'm using; with "cannot obtain current location" both A and B fail, address name lookup is item C.
i.e. this is pretty much "standard google services for geo lookup", as provided by com.google.android.gms:play-services-location (i'm at the latest version 21.0.1)

** A) try to get current location **
-- com.google.android.gms.location.LocationSettingsRequest, com.google.android.gms.location.SettingsClient
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
SettingsClient client = LocationServices.getSettingsClient(context);
Task<LocationSettingsResponse> task = client.checkLocationSettings(builder.build());

** B) fallback: try to get the cached "last known location" **
-- com.google.android.gms.location.FusedLocationProviderClient
Task<Location> task = client.getLastLocation();

** C) address lookup
-- android.location.Geocoder
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), GeoLocationManager.MAX_RESULT_SIZE);

regards

    patienttruth99

    ** A) try to get current location **

    -- com.google.android.gms.location.LocationSettingsRequest, com.google.android.gms.location.SettingsClient
    LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
    SettingsClient client = LocationServices.getSettingsClient(context);
    Task<LocationSettingsResponse> task = client.checkLocationSettings(builder.build());

    This code doesn't get the current location, it only checks location settings.

    ** B) fallback: try to get the cached "last known location" **

    -- com.google.android.gms.location.FusedLocationProviderClient
    Task<Location> task = client.getLastLocation();

    This code asks for "the most recent historical location currently available". It can and does return nothing sometimes:
    https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient#public-abstract-tasklocation-getlastlocation

    ** C) address lookup

    -- android.location.Geocoder
    Geocoder geocoder = new Geocoder(context, Locale.getDefault());
    List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), GeoLocationManager.MAX_RESULT_SIZE);

    Geocoding doesn't work on GrapheneOS, see
    https://github.com/GrapheneOS/os-issue-tracker/issues/23
    https://github.com/GrapheneOS/os-issue-tracker/issues/2302
    https://github.com/GrapheneOS/os-issue-tracker/issues/2070

      8 days later

      muhomorr

      Thanks!

      Do you have a suggestion for a more effective/reliable way to pull location data that I should suggest to the dev?

      This app worked for me flawlessly for years on my Samsung device before I switched to my current GrapheneOS device.

        patienttruth99

        ** A) try to get current location **
        -- com.google.android.gms.location.LocationSettingsRequest, com.google.android.gms.location.SettingsClient

        LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
        SettingsClient client = LocationServices.getSettingsClient(context);
        Task<LocationSettingsResponse> task = client.checkLocationSettings(builder.build());

        This code doesn't retrieve the current location. It should call FusedLocationProviderClient.getCurrentLocation() to do that.

          muhomorr

          Thanks for the tip. I passed it on along with this whole thread, and got the quoted response. Does hunch makes sense per Graphene's security measures? And are there any of the settings that I can tweak to help this to work?

          hey,
          yes, apologies, my first snippet re current location is incomplete, i got lost in my own code.
          this is the accurate condensed version and matches what "patienttruth99" expects.
          FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(context);
          //.. body of task1:
          CancellationTokenSource cts = new CancellationTokenSource();
          client.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, cts.getToken());
          //.. body of task2, this executes if task1 fails:
          client.getLastLocation();
          //.. if task2 also runs into failure or returns null then we show "cannot obtain location"

          also, what's important to note: my app uses a "Foreground Service" to run these tasks.
          As per standard Android implementation, this is allowed (and works fine for all my users) as long as that foreground service is started by a "component in the foreground" (that is, an Activity, a Statusbar notification action click, or a homescreen widget click).

          my hunch is that this is where GrapheneOS is more strict, killing the request because it's within a service. 

          it might work correctly (or at least would be an interesting experiment) on my side if i'd move that code directly into the main app activity, but i'd rather not do that (of all my users you're probably the only one with GrapheneOS + location lookup enabled). plus it would still not solve the "Geocoder" issue.

            patienttruth99
            Did you enable "Improve Location Accuracy" toggle in Settings -> Apps -> Sandboxed Google Play -> Google Location Accuracy?

            On my devices, Time Recording app is able to obtain location both with and without Google's location service.

            Obtaining location without Google's location service fails sometimes due to Time Recording setting a short timeout: it doesn't wait long enough for location to become available.

            Converting location into an address doesn't work on GrapheneOS due to the lack of a geocoder service.

              4 days later

              muhomorr

              I have improve location accuracy turned on.

              Interesting that it works for you. So, does it work if you hit switch task from the notification that is present when you have an active task? For me that's when I have the issue, or from hitting switch task within the app. If I go into the menu on the task itself it is able to pull the location. For some reason.

                patienttruth99

                So, does it work if you hit switch task from the notification that is present when you have an active task?

                I don't have a notification from Time Recording app when an active task is present.

                or from hitting switch task within the app. If I go into the menu on the task itself it is able to pull the location.

                Time Recording app discards the location that it receives after "Check in now" / "Check out now" etc buttons are pressed, likely because it's unable to convert that location into an address (GrapheneOS currently doesn't have a geocoder).

                Location that it receives when "task menu -> Geo location" is selected doesn't get discarded, despite the app still being unable to convert it into an address.

                  12 days later
                  3 months later

                  Having issues with all my map apps. One of them shows a place I was at a few days ago as my location. The others can't find me at all. Any ideas?

                  Not using any google services for my main profile. I am for my 2nd profile. 2nd profile has google maps and can't find my location.

                    Bobby123 Have you followed the instructions here to set up geolocation with Google?

                    Usually, you can find helpful suggestions in the Settings app that will tell you how to fix location. Go to Settings > Apps > Sandboxed Google Play. You might find a section called "Potential issues" where it'll tell you what settings you need to change to fix or improve location services.

                    Other settings you'd want to verify in the setting pane I mentioned above:

                    • turn off Reroute location requests to the OS
                    • enable Google Location Accuracy
                    • make sure Google Play Services has location access

                      other8026

                      Thanks. Tried all of that. Still no location. And like I say I don't have google play services on my owner profile which I use organic maps and magic earth maps.

                        • [deleted]

                        Bobby123 like I say I don't have google play services on my owner profile which I use organic maps and magic earth maps.

                        If the troubled apps are in the Owner yser, you will need to setup geolocation with Google in the Owner user.

                          Bobby123 Okay. I wasn't clear on which profile you used these apps from.

                          In the profile without Sandboxed Google Play, you'd basically need a clear view of the sky for it to work. But it seems like you must have been using these apps before and they just suddenly stopped working. Is there anything that happened that coincided with the apps being unable to get location? Like an update or you changing some settings?

                          One app that could be helpful for you to troubleshoot location issues is GPSTest. You can use this app to see if your phone can "see" gps satellites.

                          If you haven't already checked, you can make sure everything is set up correctly in Settings > Location. And it wouldn't hurt to double check the apps you want to access location still have permission to access location in case their permissions were reset for some odd reason.

                          Lastly, it never hurts to reboot the phone to see if that does anything.