This object is in archive! 

Use new FileProvider API for sharing data from G4L add-on

R5O.nl shared this problem 7 years ago
Solved

Wanted to share this issue, that I just ran in to on 2 separate devices, but both running Android 7.1.1, nAOSP ROM of Jan 2017 (from XDA). So you could dismiss this issue as 'you are a nasty tweaker' :)


From a mail from GC.com on reporting a new cache I select the cache URL in the mail and G4L is run to retrieve the new cache (so I can load it into Locus). But G4L does not have the right permissions yet, on app level in Android and a popup comes asking permission for access to the SD card: I grant it. Upon again selecting the cache's URL in the mail, then G4L reports this exception: see screenshot. It says IllegalStateException in a new popup. I double check in Settings/Apps/G4L/Permissions and I see 2 permissions (location and SDCard) and both active now. But repeating the selecting of the URL then every time the exception is thrown.

I run a logcat on this issue and save it: also attached. Some of the lines in there:

D/ActionDisplayPointsExtended(16924): Cache file for Locus: /storage/emulated/0/Geocaching4Locus/data.locus

E/UserTask(16924): An error occurred while executing doInBackground()

E/UserTask(16924): java.lang.IllegalStateException: External storage (or SD Card) is not writable.


Then again I go into Settings/Apps/G4L and I Stop the app (there is a button there for doing that). After this action, G4L will work properly and will load the cache into Locus when selecting the URL in the email. So this feels like a 'App needs to reload its permissions upon restart'. So basically, it is not a real issue for me, but it might cause confusion.

EDIT: just tried on a N9, also with nAOSP 7.1.1 ROM: first checked what the permissions are to start with: none of the permissions are set yet. I select the mail and it pop up with 'please allow bla bla', so I do. And now it DOES perfectly continue into Locus and load the cache properly . Shoot me; just wanted to share anyway :)

Replies (2)

photo
1

Good day R50,

thanks for a precise bug report. From your last "edit" ... so is it now working correctly on all devices? If not, Arcao, is this a problem you told me about few weeks ago? If so, are you able to simulate it? Because on my device with Android 7 it works fine as well.

photo
1

Yes, I wrote about it via Hangouts.


Android 7 disabled access to another app data directory even if that app allowed it with a file permission. The correct way is to use ContentResolver and pass a file descriptor over it. Unfortunately this needs changes in Locus API.


So I added permission to write external storage (actually second internal storage) in an add-on and I write data file in <external-storage>/Geocaching4Locus/data.locus. But as I read this is not error free, also Crashlytics confirm it.

Replies have been locked on this page!