I'm trying to start an intend to start a "send via.." intend.
This works on an old Android 4.4.2 device, however on devices with Android 8+ it fails.
Notes:
The old device migth be positively affected by the manifest-setting:
The used code:
The log shows "True" just before the "StartActivity(lIntent)" which fails with:
Is there a limitation on such actions?
This works on an old Android 4.4.2 device, however on devices with Android 8+ it fails.
Notes:
The old device migth be positively affected by the manifest-setting:
Project Manifest:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="19" />
)
The used code:
Send Via Code:
Private Sub SendVia_Click
'Sendet das aktuelle Spiel
'zuerst das Spiel speichern
Dim lSpielstand As String=Spielstand_speichern
Dim lSerial As Serial
lSerial.Initialize("mySerial")
Dim lFileName As String= lSerial.Name & "_Patience.dat"
Dim lTW As TextWriter
lTW.Initialize(File.OpenOutput(rp.GetSafeDirDefaultExternal("") , lFileName, False))
lTW.WriteLine(lSpielstand)
lTW.Close
Dim lUri As Uri 'ContentResolver library
lUri.Parse("file://" & File.Combine(rp.GetSafeDirDefaultExternal(""),lFileName))
Dim lIntent As Intent
lIntent.Initialize(lIntent.ACTION_SEND, "file://" & File.combine(rp.GetSafeDirDefaultExternal(""),lFileName))
lIntent.PutExtra("android.intent.extra.STREAM",lUri)
lIntent.SetType("text/*")
Log(File.Exists(rp.GetSafeDirDefaultExternal(""),lFileName))
StartActivity(lIntent)
End Sub
The log shows "True" just before the "StartActivity(lIntent)" which fails with:
Error:
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/Opus.Patience/files/Galaxy Tab A_Patience.dat exposed beyond app through ClipData.Item.getUri()
Is there a limitation on such actions?