Mo Valipour
Mo Valipour

Reputation: 13486

window.requestFileSystem on Phonegap for Android fails with code 9

I'm using Phonegap to develop an HTML5 application for android but when I try the following code to acquire a file system:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fsSuccess, fsFail);

I get error code 9 i.e. INVALID_MODIFICATION_ERR.

According to this source, this is caused by the lack of an SD card on the device, but my android device has 1.5GB of internal storage on it. and of course not all devices are expected to have external SD on them!

How can I alternate this behaviour and tell phoneGap to use any file system on the device?

Thanks

Upvotes: 2

Views: 4668

Answers (2)

Marvin Emil Brach
Marvin Emil Brach

Reputation: 3972

What do you do in your function fsSuccess? I'm aware of that error since I tried to open a file with exclusive=true although it already existed.

And why requesting 0 bytes of space? Try to set an value greater then 0 like 1024*1024 (1MB). Possibly that's the problem...

Upvotes: 0

Simon MacDonald
Simon MacDonald

Reputation: 23273

Do you have the following permission in your AndroidManifest.xml?

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Also, as you said if your device doesn't have an SD Card it will fail. What device is it?

Get back to me on this and if you are really stuck I will raise a bug on PhoneGap and see if I can get it fixed before the 1.4 release drops Jan 30th.

Upvotes: 1

Related Questions