Write to SD card on Android

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Write to SD card on Android

Ken Fast
I have a JOGL application running on Android 4.4.2.  I am trying to add the ability to write to a file on the /sdcard external storage.  At run time I get an error,
    java.io.FileNotFoundException: /storage/emulated/0/test1.txt: open failed: EACCES (Permission denied)

The same code for writing to an external file works in an app without JOGL.

I see a curious line in the release notes for V2.0-rc9 (http://forum.jogamp.org/Release-v2-0-rc9-td4025255.html) as follows:

GlueGen (31):
     ...
     ...
      Android Launcher: Add dummy version activity (recognized by market), remove permissions: inet and write-sd

What exactly does that mean that the permissions for write-sd have been removed?  Is there any way to restore them?  Does it make sense that this is the cause of the runtime error?

The GlueGen Version app on my device says that I am running version 2.3.2
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

elect
I can't help you, but I wanted to ask if you tried the the version previous that V2.0-rc9 to see if that works
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

Ken Fast
I have not tried an earlier version.  I was hoping to get some guidance from the developers as to whether this was intended/expected behavior.
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

elect
Ken Fast wrote
I have not tried an earlier version.  I was hoping to get some guidance from the developers as to whether this was intended/expected behavior.
If you have spare time, you may want to give it a try, at least you will know if it is really that commit the problem

Hopefully, however, gouessej or somebody else will reply you :)
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

gouessej
Administrator
In reply to this post by Ken Fast
Ken, can you modify GlueGen, rebuild it and test it with your application?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

Ken Fast
For my Android work I just downloaded the pre-built APK for GlueGen, so I do not have the whole project.  I think one of my co-workers has the GlueGen project for PC based development.  I will look in to that.  Would it be as simple as adding a <uses-permission/> line in the manifest for the GlueGen Launcher project and rebuilding/reloading the APK?
Reply | Threaded
Open this post in threaded view
|

Re: Write to SD card on Android

Ken Fast
Just to clarify.  I am trying to write to the public area of the SD card [getExternalStorageDirectory()] and getting an error.  This would end up under .../sdcard/.../.  I tried writing to the app private area of the SD card [getExternalFilesDir()] and that worked.  This ends up under the .../sdcard/.../Android/data/<package name>/data/ directory.  This is an acceptable workaround for me.  I am also able to write to the app private internal storage area.  That directory is not very useful for me because I can't access it from outside of my app.