Android Question external memory access

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi,

until sdk 28 i could ask permission to access external memory and once got it i could read / write to external memory

now with sdk 29/30 i can't get the permission - the app crashes

is there a new way to do so or i'm (as usuall) am making something wrong ?
the code did not change - it was working perfectly on 28

thanks
 

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User

Erel,
did read the link you sent me.
got more confused and did not see answer to my question
i also think it is not really relevant (sorry...) as google demands any new app or update to be of sdk 29 or 30
as i said - on 28 all worked perfectly.
so if i go back to 28 - and want to update the app i will get problems from google so i must obey their ruls
i need to access external memory to retrieve some data and then i changed the app to store it in internal memory
but i need this access to get the stored data

how do i get it ?

thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
All your questions are answered in that thread:

1614765711563.png
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
All your questions are answered in that thread:

View attachment 108994
Erel, sorry for being a pest...

i'm not trying to use these permissions or commands

i am trying to get permission
For Each permission As String In Array(rp.PERMISSION_READ_PHONE_STATE, rp.PERMISSION_READ_EXTERNAL_STORAGE, rp.PERMISSION_CAMERA)

if i omit the external memory read permission - it works
when i use it the app crashes

what i need is this

SaveDir = File.DirDefaultExternal

and then to read some data stored there and move it to internal and no more external

on 28 all fine
29 or 30 - crash

what can i do to overcome this hurdle ?

thanks again (and i'm not trying to test your patience :))
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Accessing FIle.DirDefaultExternal is trivial. Just use RuntimePermissions.GetSafeDirDefaultExternal. No permission needed.
ok, now it doesn't crash
i use
For Each permission As String In Array(rp.PERMISSION_READ_PHONE_STATE, rp.PERMISSION_CAMERA, rp.GetSafeDirDefaultExternal(""))
the app asks for first 2 permissions and not for the 3rd
so i don't get the permission
i know i'm missing something here...
help...
 
Upvote 0
Top