pellicceama / Sample-File

This sample shows you how to use the FileSystem Apache Cordova core plugin to access and work with the file system of a device.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File System

Try in AppBuilder

Overview

This sample shows you how to use the FileSystem core plugin to write, read and delete files in the file system of a device.

Supported mobile platforms: iOS, Android, Windows Phone

Developed with: Windows Phone SDK 8.1, Apache Cordova 3.7.0

Back to Top

Important Directories and Files

scripts\fileHelper.js: This file introduces the following public methods.

  • deleteFile: Deletes file by name.
  • writeLine: Writes single text line in the specified file.
  • readTextFromFile: Reads the text in the specified file.

Back to Top

Screenshots

Platform Home
All

Back to Top

Test the Sample

Apart from exploring the sample code base in GitHub, you can also clone and run the sample in your preferred AppBuilder client.

In-Browser

With the AppBuilder in-browser client, you can develop hybrid and NativeScript cross-platform mobile apps from your browser. You can use the in-browser client at https://platform.telerik.com.

Clone the sample

  1. Click the button at the top of this document.
  2. Provide your login credentials, if prompted.

Run the sample

  1. Run in the companion app.
  2. Deploy on device via QR code.
  3. This sample is not supported in the device simulator of the in-browser client.

Back to Top

Windows

With the AppBuilder Windows client, you can develop hybrid and NativeScript cross-platform mobile apps from your Windows desktop. You can download and install the Windows client from http://www.telerik.com/appbuilder/windows-client.

Clone the sample

  1. Verify that the AppBuilder Windows client is running and you are logged in the Telerik Platform in the account in which you want to develop your application.
  2. In the dashboard, click Samples and select Hybrid.
  3. From the Workspace drop-down menu, select the workspace in which you want to develop your application.
  4. Select Core APIs.
  5. Select File.
  6. (Optional) Rename the project.
  7. Click Clone.

Run the sample

With the AppBuilder Windows client, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

Visual Studio

With the AppBuilder extension for Visual Studio, you can develop hybrid and NativeScript cross-platform mobile apps from Microsoft Visual Studio. You can download and install the extension from http://www.telerik.com/appbuilder/visual-studio-extension.

Clone the sample

  1. Verify that the AppBuilder extension for Visual Studio is running and you are logged in the Telerik Platform in the account in which you want to develop your application.
  2. Select AppBuilderGet Sample.
  3. Select Hybrid.
  4. Select Core APIs.
  5. Select File.
  6. (Optional) Rename the project.
  7. Click Get.

The extension for Visual Studio copies the sample files locally. The extension creates a new solution and project and loads them.

Run the sample

With the AppBuilder extension for Visual Studio, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

CLI

With the AppBuilder command-line interface, you can develop hybrid and NativeScript cross-platform mobile apps from the command line. You can learn how to add the AppBuilder commands to your command line from http://www.telerik.com/appbuilder/command-line-interface.

Clone the sample

  1. Verify that a command prompt is running and you are logged in the Telerik Platform in the account in which you want to develop your application.

  2. To list the available samples, run the following command.

    appbuilder sample
  3. Run the clone command for the sample as listed by appbuilder sample.

    appbuilder sample clone file

The AppBuilder command-line interface shows the following message: Successfully initialized project in the folder!

Run the sample

With the AppBuilder command-line interface, you can quickly test your apps on device, in the simulator or in the native emulators.

  1. Run in the device simulator.
  2. Run in the companion app.
  3. Run in the native emulators.
  4. Deploy on device via QR code.
  5. Deploy via cable connection.

Back to Top

Limitations

  • In the device simulator, you need to set the persistent and temporary file storage set for the LocalFileSystem object. You can choose folders from your local file system and set them for the LocalFileSystem constants.
  • The device simulator returns the following constants: %simulator_persistent_root% and %simulator_temporary_root% for the persistent and the temporary root paths, respectively.
  • File paths are case sensitive in iOS and case insensitive in Android.
  • This sample is not supported in the device simulator of the in-browser client. Limitations of device simulator.

Back to Top

About

This sample shows you how to use the FileSystem Apache Cordova core plugin to access and work with the file system of a device.

License:Other


Languages

Language:JavaScript 96.2%Language:CSS 3.0%Language:HTML 0.7%