Skip to content

marcusasplund/ionic2-camera-demo

Repository files navigation

ionic2-camera-demo

GitHub issues Build status dependencies Stack Share

Example of using Cordova Camera in a ionic2 application

Only tested in Android

If you don't have it already, first install the latest ionic2 and cordova, i noticed that it was a good idea to uninstall my really old cli:s first

install

$ npm uninstall -g ionic
$ npm install -g ionic
$ npm uninstall -g cordova
$ npm install -g cordova

A short way to try out this project:

$ git clone https://github.com/marcusasplund/ionic2-camera-demo.git
$ cd ionic2-camera-demo
$ npm install
$ npm run build
$ ionic cordova build android

install .apk and test

The long way to try out this project:

Install a starter project

(heads up: this project is written in typescript, if you want plain js, skip the flag --ts)

$ ionic start ionic2-camera-demo --v2 --ts
$ cd ionic2-camera-demo

Install Camera plugin

$ ionic cordova plugin add cordova-plugin-camera --save
$ npm install --save @ionic-native/camera

Checkout the latest api:

https://ionicframework.com/docs/native/camera/

Heads up, in the file app.module.ts you need to add:

import { Camera } from '@ionic-native/camera';

And add Camera in the providers array, like so:

providers: [
    StatusBar,
    SplashScreen,
    Camera,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
]

Install Cordova typedefs (if you write in typescript this part is needed)

$ (sudo) typings install dt~cordova --global
$ (sudo) typings install dt~cordova-plugin-camera --global

download folder "app" from this project and replace folder "app" with this

$ npm run build

$ ionic cordova build android

install .apk and test

About

Example of using Cordova Camera in a ionic2 application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published