Introduction
- Nodejs
- Latest Ionic 3 CLI
- Latest Cordova
- Node Command Line Window (Windows) or Terminal (OS X, Linux)
- Text Editor or IDE (e.g. Visual Studio Code, Atom,)
Once we've installed Node.js, we are able to install other tools on the terminal or command line. Run the following command.
npm install -g ionic cordova
Once the installation is finished, let’s start creating an Ionic 3 app.
Create an Ionic 3 app
Open your node.js terminal and open a specific location to create the Ionic 3 app. Start a new Ionic project using the ionic start command.
ionic start myApp
This command will take a few minutes because it has installed all dependencies and modules in a project. Now, change the location to myApp.
cd myApp
Once we've changed the location of myApp, add an Android platform to your app.
ionic cordova platform add android
ionic cordova platform add browser(For Browser)
Now, run the project using the following command.
ionic serve (For Browser)
ionic cordova run android(For Device)
Make sure that you have connected the device and the settings have been set.
Now, let’s start.
- CameraThe Camera Plugin is used to take a picture and also capture a video.
- FileUsing the File Plugin, we can achieve the following -
- Get the available free space
- Check if the directory is available or not
- Create a directory
- Remove a directory
- Move a directory from one place to another place,
- Copy a directory
- List an available directory
- Set pre-defined path
- Check if a file is available or not
- Create a file
- Remove a file
- Write a file
- Read a file as a text
- Read a file and return base64 data
- Read a file and return data in a binary format
- Read a file and return data in an array buffer format
- Move and copy files
- Get a directory or file etc.
Install and Configure Camera and File
Follow the below-mentioned steps.
Step1
Now, we have an Ionic app so we can move forward. First, install the camera plugin to our Ionic app using the following steps.
ionic cordova plugin add cordova-plugin-camera
npm install --save @ionic-native/camera
Now, install the file plugin to the Ionic app using the following steps.
ionic cordova plugin add cordova-plugin-file
npm install --save @ionic-native/file
Step 2
Now, we have already installed a camera plugin and file so we need to add a Camera plugin and File plugin to our app module file.
app.module.ts file
- //here importing lines for access camera object and file plugin to our app.
- import {
- Camera
- } from '@ionic-native/camera';
- import {
- File
- } from '@ionic-native/file';
- @NgModule({
- providers: [
- //here added class to our provider service block
- Camera,
- File
- ]
- })
- export class AppModule {}
Step 3
Now, it’s time to integrate with a component in our app.
app.ts file

Risto KurniawanPosted Dec 25, 2019, 7:37 AM
I want to save image in ion-img to internal storage, it is possible to use that code?
mahesh kumarPosted Aug 21, 2019, 7:50 AM
How to save csv file to desired loaction ionic 4
ravi patelPosted Jul 26, 2019, 7:27 AM
Getting this error please help
ravi patelPosted Jul 26, 2019, 7:26 AM
The string to be decoded is not correctly encoded.Error: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
Harshitha PPosted Dec 19, 2018, 4:45 AM
Thank You.
Muthu KumarPosted Dec 13, 2018, 5:04 AM
Sorry that's my mistake, you can change like this, let DataBlob = this.base64toBlob(base64Data, contentType);
Harshitha PPosted Dec 12, 2018, 4:08 AM
What we need to pass in content to this method this.base64toBlob(content, contentType)