Problems writing to USB flash drive

Discussion in 'The Business Forum' started by Walter, Jun 8, 2015.

  1. Walter

    Walter Member Licensed User

    In my application I want to captured data
    Save by Button Click on a USB stick.
    Tablet Android 4.2

    And I get the following error:
    open failed: AEACCES (Permission denied)

    When reading files in the USB flash drive I have no problems!

    Are there simple and really working example?
     
  2. DonManfred

    DonManfred Expert Licensed User

    Do you have added the right permission to your manifest?
    Code:
    AddPermission(android.permission.WRITE_EXTERNAL_STORAGE) ' Allows an application to write to external storage.
    I dont know from which android version the access to external storage is limited by google... Maybe 4+

    In this case you should use
    Code:
    File.DirDefaultExternal
     
  3. Walter

    Walter Member Licensed User

    Thanks for the information
    Error has remained

    File.Copy (File.DirRootExternal, "INI.txt", "/ mnt/usbhost1", "INI.txt")
     
  4. sorex

    sorex Expert Licensed User

    that space between / & mnt is that copy/paste thingy?
     
  5. Walter

    Walter Member Licensed User

    only at our Info
    the App it is natural
    File.Copy (File.DirRootExternal, "INI.txt", "/mnt/usbhost1", "INI.txt")

    Same mistake!
     
  6. DonManfred

    DonManfred Expert Licensed User

    Most probably you app just dont have the permissions to write to that path. It is limited by Android.

    See this answer from Erel to find the right paths you can try.
     
  7. Walter

    Walter Member Licensed User

    at 4.3 it works
    4.2.2 when it does not work
    both devices are not rooted

    available at 4.2.2 Additional settings?
    root manger says setting = r / w
     
Loading...