Android Question File.Dir for help!

teddybear

Well-Known Member
Licensed User
A simple code for testing File.Dir. it works well in phone, but in TvSet it does not work.
code is following
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    Dim rp As RuntimePermissions
    Dim folder As String
    folder = rp.GetSafeDirDefaultExternal("")
    Log(folder)
    Log(File.ListFiles(folder))
    Log(File.DirRootExternal)
    Log(File.ListFiles(File.DirRootExternal))

    Dim jo As JavaObject
    jo.InitializeNewInstance("java.io.File", Array(File.Combine(File.DirRootExternal, "/")))
    Dim CanonicalPath As String = jo.RunMethod("getCanonicalPath", Null)
    Log(CanonicalPath)
    Log(File.ListFiles(CanonicalPath))
End Sub

logs

B4X:
** Activity (main) Create, isFirst = true **
/storage/emulated/0/Android/data/b4a.example/files
(List) Not initialized
/storage/emulated/0
(List) Not initialized
/storage/emulated/0
(List) Not initialized
** Activity (main) Resume **

It seems not have permission to read filedir
 

teddybear

Well-Known Member
Licensed User
Solved. an odd problem. referencing to B4A_bridge, I found only this device requires external storage permission
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Are the phone and the TV running the same levels of Android? If not then that will explain the different behaviours.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…