Android Question File permission problem - cannot read file

barryhuntpinncomp

Member
Licensed User
Longtime User
Until recently my program has been able to write and read a particular file. For no apparent reason the file cannot be read at present. I get
java.io.FileNotFoundException: /storage/emulated/0/BarryWalk/rates.txt (Permission denied)

File.exists returns true.

The file can be read by a different program on the same device. The two program's manifest are identical.
They both contain
AddPermission(android.permission.WRITE_MEDIA_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)

I cannot think of any other settings.

Any help would be much appreciated.
 
There is only one device running two programs. Both programs have the identical read statement.
l= File.ReadString(File.DirRootExternal, "/BarryWalk/rates.txt")
One works and the other does not
 
Upvote 0
Upvote 0
Thank you for the link.
When I add the module Runtimepermissions (without any extra coding) I get a compile error.
Maven artifact not found: android.arch.lifecycle/livedata-core
 
Upvote 0
OK, great thank you.

I have now added the "RunPermission" library but I am struggling as to how it should be used.

I tried
rp.CheckAndRequest("PERMISSION_READ_EXTERNAL_STORAGE")
Log(rp.Check ("PERMISSION_READ_EXTERNAL_STORAGE")) - it returned false but I admit to being out of my depth.
 
Upvote 0
Back
Top