Android Question I need to write sd card permission

khosrwb

Active Member
Licensed User
Longtime User
hi
I want copy file in sd card
but I can't write in sd card and I get to this error and crash app

in manifest I add these codes :

B4X:
AddPermission(android.permission.WRITE_INTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.REQUEST_INSTALL_PACKAGES)
AddPermission(android.permission.WRITE_MEDIA_STORAGE)
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    203.6 KB · Views: 234

khosrwb

Active Member
Licensed User
Longtime User
ok
I want copy file in sd card
but I can't write in sd card and I get to this error and crash app
in manifest I add these codes :

B4X:
AddPermission(android.permission.WRITE_INTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.REQUEST_INSTALL_PACKAGES)
AddPermission(android.permission.WRITE_MEDIA_STORAGE)

I get to this error :

copyAddrssDir : /storage/AE8B-A854
copyFileName : 00001.vcf
addrss : /storage/AE8B-A854
changeCopyFileName : 00001(1).vcf
Error occurred on line: 842 (Main)
java.io.FileNotFoundException: /storage/AE8B-A854/00001(1).vcf (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:448)
at anywheresoftware.b4a.objects.streams.File.Copy(File.java:341)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:780)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:363)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:259)
at b4a.example.filemanager.main._mycopysub(main.java:1497)
at b4a.example.filemanager.main$ResumableSub_btnPaste_Click.resume(main.java:1459)
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:735)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$1.onClick(Common.java:481)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:175)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)


I write sd card addrss path
 
Upvote 0

khosrwb

Active Member
Licensed User
Longtime User
I use these permissions ::)

B4X:
AddPermission(android.permission.WRITE_INTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_MEDIA_STORAGE)

:eek:what's permission needed for read/write on sd card ?o_O


excuseme if my language isn't good. :(
 
Upvote 0
Top