Hi,
i made a collection of gpx tracks that i open with an axternal GPS program (like Oruxmaps) copiyng gpx file from File.DirAssets to File.DirRootExternal for permitting GPS program to read it
I know that with android:targetSdkVersion < 23 in AndroidManifest there is no problem but due to Google latest request android:targetSdkVersion must be >=26
So i started to implement RuntimePermission in libraries and CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) in code
when i start my app first i check if exist an exchange folder where to put my files
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
This works, first time when i start app the system says to enable files access
But when i try to lauch GPS program (it starts automatically due to file association) with this code
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I obtain always Toast Message "Non posso aprire il file"
Where is my error?!?
Thank you in advance
Sergio
			
			i made a collection of gpx tracks that i open with an axternal GPS program (like Oruxmaps) copiyng gpx file from File.DirAssets to File.DirRootExternal for permitting GPS program to read it
I know that with android:targetSdkVersion < 23 in AndroidManifest there is no problem but due to Google latest request android:targetSdkVersion must be >=26
So i started to implement RuntimePermission in libraries and CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) in code
when i start my app first i check if exist an exchange folder where to put my files
			
				B4X:
			
		
		
		Sub Process_Globals
    Public rp As RuntimePermissions
End Sub
Sub Activity_Create(FirstTime As Boolean)
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, result As Boolean)
    If result Then
        If File.IsDirectory(File.DirRootExternal,"scabr/") = False Then
            File.MakeDir(File.DirRootExternal, "scabr")
        End If
    End If
    Activity.LoadLayout("Splash")
    Sleep(2000)
    Activity.Finish
    StartActivity("Principale")
End Sub
	But when i try to lauch GPS program (it starts automatically due to file association) with this code
			
				B4X:
			
		
		
		Sub LstTracce_ItemClick (Position As Int, Value As Object)
    Dim traccia As String
    traccia="Pnalm_" & Value & ".gpx"
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, result As Boolean)
    If result Then
        If File.Exists(File.DirRootExternal, "/scabr/" & traccia) = False Then
            File.Copy(File.DirAssets, traccia, File.DirRootExternal, "/scabr/" & traccia)
        End If
        Dim i As Intent
        i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal, "/scabr/" & traccia))
        i.SetType("text/xml")
        Try
            StartActivity(i)
        Catch
            ToastMessageShow("Non posso aprire il file.", True)
        End Try
    End If
End Sub
	I obtain always Toast Message "Non posso aprire il file"
Where is my error?!?
Thank you in advance
Sergio