Subname: DevicePaths
 
Description: Use to find all mount points on a device. This should work with all versions below Android 4.3, at which time they changed the OS where it can not access the needed information. You do not need to change the manifest as the line: dp = File.DirRootExternal in the code below, will add the permissions needed.
 
Dependencies/Libraries: none
 
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
 
Example: On my ASUS TF-101 with keyboard attached, returns:
Tags: Mount, Mounts, SDCard, External, Memory, ExternalMemory, DirRootExternal
			
			Description: Use to find all mount points on a device. This should work with all versions below Android 4.3, at which time they changed the OS where it can not access the needed information. You do not need to change the manifest as the line: dp = File.DirRootExternal in the code below, will add the permissions needed.
Dependencies/Libraries: none
			
				B4X:
			
		
		
		Sub GetMountPoints
    'Call like this
    Dim MountPoints As Map = DevicePaths
    'Log here just to show the results
    Log("Device Paths Found..." & CRLF & "_____________________")
    For i = 0 To MountPoints.Size -1
        Log(MountPoints.GetKeyAt(i) & ", " & MountPoints.GetValueAt(i))
    Next
End Sub
 
Sub DevicePaths As Map
    'Should work with Android versions below 4.3
    Dim lp As List : Dim dpaths As Map : Dim ChkVal, dp = File.DirRootExternal As String : dpaths.Initialize
    lp = File.ReadList("/system/etc/", "vold.fstab")
    For i = 0 To lp.Size -1
        ChkVal = lp.get(i) : ChkVal = ChkVal.Replace(":", " ")
        If ChkVal.ToLowerCase.StartsWith("dev_mount") Then
            dpaths.Put(SGW(ChkVal, 2), SGW(ChkVal, 3))
        End If
    Next
    Return dpaths
End Sub
Sub SGW(CStr As String, GE As Int) As String
    Dim t As List : Dim rs, sd As String : sd = " "
    t = Regex.Split(sd, CStr)
    rs = t.Get(GE-1)
    Return rs
End Sub
	Example: On my ASUS TF-101 with keyboard attached, returns:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Device Paths Found...
_____________________
microsd, /Removable/MicroSD
usbdisk2, /Removable/USBdisk2
usbdisk1, /Removable/USBdisk1
sdreader, /Removable/SD
Tags: Mount, Mounts, SDCard, External, Memory, ExternalMemory, DirRootExternal
			
				Last edited: