This is the code working for years up to Android 12 since Android 8.
manifest is like this
I recall it worked in Android 13 about a month ago. But now failed to get permission then prompt "Failed to create file" all the time.
I am not using Google Store but put apk in private server for download.
I recently compiled min sdk 21 and target sdk 35. Now recompiled as min sdk 21 and target sdk 33. Neither working.
B4X:
gRp.CheckAndRequest(gRp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Dim outs As OutputStream = File.OpenOutput(gRp.GetSafeDirDefaultExternal("") , gs_filename, False)
...
outs.Close
Else
ToastMessageShow("Failed to create file", False)
End If
manifest is like this
B4X:
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="30" />
)
I recall it worked in Android 13 about a month ago. But now failed to get permission then prompt "Failed to create file" all the time.
I am not using Google Store but put apk in private server for download.
I recently compiled min sdk 21 and target sdk 35. Now recompiled as min sdk 21 and target sdk 33. Neither working.