vmag
Active Member
Helo,
not work for android 9:
on android 5, 6, everything works if there are lines in the manifest:
on android 9, it doesn't help, is there a way out?
Thanks!
Manifest:
Button1 code:
not work for android 9:
B4X:
File.Copy(xui.DefaultFolder, "NameFile", File.DirRootExternal, "NameFile")
B4X:
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
Thanks!
Manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private Button1 As B4XView
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
If File.Exists(xui.DefaultFolder, "input_output.txt") = False Then
File.Copy(File.DirAssets, "input_output.txt", xui.DefaultFolder, "input_output.txt")
End If
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
Try
File.Copy(xui.DefaultFolder, "input_output.txt", File.DirRootExternal, "input_output.txt")
xui.MsgboxAsync("Ok!","Ok!")
Catch
xui.MsgboxAsync("File not copy!","Error!")
End Try
End Sub