Closed JacksonChen666 closed 4 months ago
I'm currently working on this, at least partially.
I'm able to create a channel for errors.
I'm able to send an error notification when all permissions have been denied.
I'm going to start showing error notifications when file writes fail due to IOException or SecurityException. However, I'm going to try making it a single notification so it doesn't become overwhelming. It could be that each file writer fails and results in a notification but each one overwrites the other... which is a bit weird. Need to think of a way to make this efficient maybe.
Here's what the notification looks like:
I've chosen Visibility Public and Priority High. I'm assuming a user would want to know that their writes or the app is failing?
I can't do anything if the user denies notification permissions!
I ran into a really nasty situation where notification permissions were denied while everything else was accepted - I think it's basically this complex StackOverflow thread. The app would think it had all permissions and start the service, but because notifications were denied, it would immediately stop the service, and because the foreground service started but didn't show a notification within 5 seconds, it crashes the app, and starts a crash-restart-crash loop. I've modified the stop service code so that if notification permissions are denied it doesn't stop the app. Weird hacky workaround that's going to make zero sense in 1 month from now :cry:
When location or all permissions are denied (except notifications!)
When location or all permissions are denied (except notifications!)
nearly invisible warning icon 👀
So invisible I forgot it was there haha.
I was using the built-in android.R.drawable.stat_notify_error
I wonder if there's something else I could do.
I'm able to create a channel for errors.
I'm able to send an error notification when all permissions have been denied.
I was actually thinking about like a pop-up prompt in-app when you open the app or start logging, since that's usually how I start the GPS logging
Notification still makes sense for when "Start on bootup" is enabled
There should be one already when you start logging, if the file write permission is denied, then a popup appears like this
And if all permissions denied then that "first time permissions" apologetic prompt should appear already right when the app is launched. Are you not seeing that?
I didn't realize you meant in-app. I'm wondering I should probably continue anyway with the notifications since it could cover both use cases, in-app and background service.
There should be one already when you start logging, if the file write permission is denied, then a popup appears like this
And if all permissions denied then that "first time permissions" apologetic prompt should appear already right when the app is launched. Are you not seeing that?
I am seeing no prompts when I start logging, after the permissions are bugged. I tried manually throwing the permission away by hand, but I did get prompted for it again. So this "GPSLogger didn't prompt me when it couldn't write to the file" issue is probably a bug caused by my phone bugging out in a very weird way (which I haven't figured out how to reproduce or any other technical detail).
One thing I noticed in the detailed view is that the filename doesn't display when logging (with new files for each logging session), but that's pretty hard to notice.
If anyone wants/is able to test, an APK is here:
https://github.com/mendhak/gpslogger/releases/tag/v131-rc2
Note that if you use the FDroid version of this app, installing this is like new, so you'll lose previous data and settings.
Sometimes the permission on my phone gets messed up (no idea why or how, just that it does) and I'll have to re-grant some permissions to apps. I often forget to re-grant the permissions for GPSLogger, since it doesn't tell me when it can't write to a file (when starting a new log), so all logs that are recorded while the permissions are broken just don't exist at all.
I've had this issue happen twice, and it took me at least a month to notice the issues in the first place.
Possibly related to #1053
(/e/OS 1.21.1, GPSLogger v130, FP4, not related to battery optimizations since it's about storage permissions and everything's fine when that's fixed)