开发者

phonegap html5 android synchonous Filesystem IO

开发者 https://www.devze.com 2023-02-07 19:54 出处:网络
How can I read and wr开发者_运维问答ite files synchronously, using PhoneGaps Filesystem API? Is there a an synchronous wrapper available?There is no way to access files synchronously through the provi

How can I read and wr开发者_运维问答ite files synchronously, using PhoneGaps Filesystem API? Is there a an synchronous wrapper available?


There is no way to access files synchronously through the provided api. Guessing from the way phonegap is implemented i doubt that you can write a plugin to do this synchronously.


Because of the way the Java-to-JavaScript bridge on Android works, it is pretty much impossible to do a synchronous implementation of File IO. This is because each Java object in Android that is bound to the JavaScript environment runs on its own thread.

Use the existing File API available in PhoneGap - but use it asynchronously. Register a callback with it that will notify your app that an IO process is complete.

0

精彩评论

暂无评论...
验证码 换一张
取 消