Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to store data to a local file using PhoneGap API

$
0
0

This example demonstrates how to store data to a local file using PhoneGap API. To access a corresponding API, it is necessary to add a link to the cordova.js file.

This example can be tested only on a mobile device.

See also:
PhoneGap Documentation - File
How to build a native package in Visual Studio
How to test PhoneGap API via the Courier tool

Question Comments

Added By: Andrea Tatone at: 7/25/2013 11:14:40 AM    

Many thanks for the example. I've tried it in the simulator and the courier, but it doesn't work (i'm working on a android 2.3.4 device). It fails with the message "File system is not accessible", either in read and write. Is there anything I can do?

Added By: Nikolai (DevExpress Support) at: 7/25/2013 11:18:07 PM    

Hi Andrea,

I have created a separate ticket regarding this issue. Please post all messages here Q377803.

Added By: Rakesh Parab at: 5/28/2014 12:15:35 AM    

plz help me 4.......
how to store .csv file to particular path in mobile like /mnt/sdcard/csvfiles .
???

Added By: Nikolai (DevExpress Support) at: 5/28/2014 7:09:53 AM    Hi Rakesh,

I have created a separate ticket for this issue How to store a file to a particular folder. Please post all comments in this ticket.Added By: User name 5 at: 2/10/2016 1:56:40 PM    I just have a couple questions on how this works: 

1. what exactly does this function do
app.fileSystem.root.getFile("test.txt", { create: true }, GetFileEntryWriter, FileSystemFail);

2. and when you are calling the GetFileEntryWriter function you aren't passing any parameters, when it is expecting the fileEntry argument. So wouldn't that make the fileEntry.createWriter(WriteFile, FileSystemFail) function not work, as it would say cannot get method of undefined field fileEntry.

3. Why separate some javascript functions into the app.html page and the others into the index.js page? 

Thanks for the help Added By: User name 5 at: 2/10/2016 1:58:41 PM    4. Plus how do I access the functions in the app.html page from the index.js page, if it is possible 

Thanks again Added By: Nikolai (DevExpress Support) at: 2/11/2016 1:00:50 AM    Hi,

Here are my comments:
1, 2, This is the File plugin API. The decription of this plugin can be found here.
3. This is just an example. There is no specific reason for declaring functions in app.html file. The main requirement is that file syste should be initialized when device is ready. This inquiry is better related to basic PhoneGap concepts rather that to DevExtreme. I suggest that you refer to the PhoneGap Documentation to learn more.
4. If you wish to access functions an any part of your code, declare them in the global context as it is done for the gotFS function.


Added By: User name 5 at: 2/11/2016 5:56:33 AM    Hi Nikolai, 

Thanks for the help, really appreciate it Added By: Nikolai (DevExpress Support) at: 2/11/2016 6:00:59 AM    My pleasure :)Added By: Şule ışık at: 6/16/2016 11:07:39 PM    Hi,
I use the code but  ı take alert 
('File system is not accessible'); why ? what am ı missing ?
Added By: Nikolai (DevExpress Support) at: 6/17/2016 6:17:05 AM    Hi,

Make sure that you are testing the project on a mobile device, not in the DevExtreme simulator.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>