Ok. I found the problem. Used the following code to check the state of
the media and discovered that the state = SHARED. Which meant that the
media was not mounted or used by the USB. In my case it was USB - so
lesson learned testing "external media access" while connected to USB
can be problematic.
private boolean checkExternalMedia(){
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable =
true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other
states,
but all we need
// to know is we can neither read nor write
Log.i(TAG,"State="+state+" Not good");
mExternalStorageAvailable = mExternalStorageWriteable =
false;
}
Log.i(TAG,"Available="+mExternalStorageAvailable+"
Writeable="+mExternalStorageWriteable+" State"+state);
return (mExternalStorageAvailable && mExternalStorageWriteable);
}
On Jan 26, 9:05 pm, RS <[email protected]> wrote:
> Hello ..
> I am writing a file to the SD card but getting
>
> INFO/SdCardManager(24132):
> Failed to create the temp file..java.io.FileNotFoundException: /mnt/
> sdcard/jest/t.txt (Permission denied)
>
> In the manifest I have the following:
> <uses-permission
> android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
> <uses-permission android:name="android.permission.INTERNET"/>
>
> Totally lost - how can I resolve this issue? I need direction :(
>
> Regards
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en