Ionic 3: CameraPreview.startCamera returns plugin_not_installed

When I invoke the startCamera the promise returns an error with the message “plugin_not_installed”.

I installed it using: $ ionic cordova:plugin add cordova-plugin-camera-preview

But i noticed that the docs for native only have “Camera” and not “CameraPreview”.

Any thoughts? Thank you very much.

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { UserProvider } from '../../providers/user-provider';
import { Diagnostic } from '@ionic-native/diagnostic';
import { CameraPreview, CameraPreviewOptions } from '@ionic-native/camera-preview';



@IonicPage()
@Component({
    selector: 'picture-preview',
    templateUrl: 'picture-preview.html',
    providers: [CameraPreview, Diagnostic]
})


export class PicturePreviewPage {


    constructor(public navCtrl: NavController,
        public navParams: NavParams,
        private toastCtrl: ToastController,
        private userService: UserProvider,
        private diagnostic: Diagnostic,
        private cameraPreview: CameraPreview) {

        this.checkPermissions();
    }

    checkPermissions() {
        this.diagnostic.isCameraAuthorized().then((authorized) => {
            if (authorized) {
                console.log('starting Camera');
                this.initializePreview();
            }
            else {
                this.diagnostic.requestCameraAuthorization().then((status) => {
                    if (status == this.diagnostic.permissionStatus.GRANTED)
                        this.initializePreview();
                    else {
                        // Permissions not granted
                        // Therefore, create and present toast
                        this.toastCtrl.create(
                            {
                                message: "Cannot access camera",
                                position: "bottom",
                                duration: 5000
                            }
                        ).present();
                    }
                });
            }
        });
    }

    initializePreview() {
        // Make the width and height of the preview equal 
        // to the width and height of the app's window
        var cameraPreviewOpts: CameraPreviewOptions = {
            x: 0,
            y: 0,
            width: window.screen.width,
            height: window.screen.height,
            camera: 'rear',
            tapPhoto: true,
            previewDrag: true,
            toBack: true,
            alpha: 1
        };

        var that = this;

        this.cameraPreview.startCamera(cameraPreviewOpts).then(function () {
            that.toastCtrl.create(
                {
                    message: "Starting Camera: OK",
                    position: "bottom",
                    duration: 5000
                }
            ).present();
        }, function (error) {
            console.log('error', error);
        });


        // More code goes here
    }

}
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.0
Ionic CLI Version: 3.0.0-beta.5
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.4
Xcode version: Not installed

Also tried the platform.ready() aproach, with no success.

I got the same problem and I did this:
ionic plugin rm --save cordova-plugin-camera-preview
ionic plugin add --save https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview

There is a Ionic Native thingie for this plugin (in beta though) that might help:
https://ionicframework.com/docs/native/camera-preview/

I updated the cli, did those steps and also:
$ npm install --save @ionic-native/camera-preview

Got it to work after that.

I know this is a bit late, but I have tried all of the above but with no luck… :frowning:

I keep on getting “plugin_not_installed” error and this is really upsetting me since my app will be based around this.