Ionic2 Study Notes (9): Accessing local devices

Source: Internet
Author: User

GreyOriginal address: http://www.cnblogs.com/greyzeng/p/5559927.html

?

??

?

Ionic2 provides a way to access the local device, but needs to install Cordova dependency, we use the call camera photo as an example to illustrate:

  • Go to project directory: CD Myfirstapp
  • NPM Install Ionic-native–save
  • Add plugin to call Camera: Ionic plugin add Cordova-plugin-carmera
  • In home.html, add the following code:

    Click button to bring up the camera:

    In the app/pages/home/home.ts:

  • Run, note: This effect must be run on the real machine/emulator, the camera's call cannot be simulated on chrome

    Ionic run Android

    Tap Click

    Click the Take photo button:

    Click Yes

?

MORE: Using Cordova-camera plugin in your Ionic 2 Apps

?

??

?

------

Previous: Ionic2 study notes (8): Local storage& SQLite

Ionic2 Study Notes (9): Accessing local devices

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.