Thank You Agraham for your reply,
i modified your code to my sub :
Sub Start_Street(modo As Int, coord As LatLng)
'https://moz.com/blog/everything-you-never-wanted-to-know-about-google-maps-parameters
Dim Intent1 As Intent
Dim Uri As String
Select Case modo
Case 1
Uri=$"google.streetview:cbll=$2.5{coord.Latitude},$2.5{coord.Longitude}"$
Intent1.Initialize(Intent1.ACTION_VIEW, Uri)
Case 0
Uri= $"geo:$2.5{coord.Latitude},$2.5{coord.Longitude}"$
Intent1.Initialize(Intent1.ACTION_VIEW, Uri )
Intent1.SetComponent("com.google.earth/.EarthActivity")
Case 2
Dim path As String = File.DirRootExternal & "/Download"
Dim filename As String = sonda.serialnum.trim
If filename = "" Then filename = "POINT"
Dim kml As String = "<kml>" & CRLF
kml = kml & " <Placemark>" & CRLF
kml = kml & " <name>" & filename & "</name>" & CRLF
kml = kml & " <description>" & filename & "</description>" & CRLF
kml = kml & " <Point>" & CRLF
kml = kml & " <coordinates>" & coord.Longitude & "," & coord.Latitude & ",0 </coordinates>" & CRLF
kml = kml & " </Point>" & CRLF
kml = kml & " </Placemark>" & CRLF
kml = kml & "</kml>" & CRLF
filename = filename.Trim & ".kml"
File.WriteString(path, filename, kml)
Provider.SharedFolder = File.DirRootExternal
Intent1.Initialize(Intent1.ACTION_VIEW, Provider.GetFileUri("Download/" & filename))
Intent1.SetType("application/vnd.google-earth.kml+xml")
Intent1.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
End Select
StartActivity(Intent1)
End Sub
this is the error that i see in log :
--------- beginning of system
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Using FileProvider? true
** Activity (main) Resume **
PERMISSION_WRITE_EXTERNAL_STORAGE = true
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Using FileProvider? true
** Activity (main) Resume **
PERMISSION_WRITE_EXTERNAL_STORAGE = true
Error occurred on line: 34 (FileProvider)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at com.Domox.Tracker.fileprovider._getfileuri(fileprovider.java:120)
at com.Domox.Tracker.main._start_street(main.java:4673)
at com.Domox.Tracker.main$ResumableSub_Label12_LongClick.resume(main.java:4576)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1714)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Download/POINT.kml
at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
... 23 more