Camera: Plugin_not_installed

Hi all,

Whem I’m running my app trough ionic View app the camera works.
But when I’m running it from a debug package build from ionic pro I’m getting an error.

My code

startCamera(selectedSourceType:number)
    {

        let iQuality = parseInt(this.localstorage.getStorage('quality'));
        let bSaveSet = (this.localstorage.getStorage('save-photos') == 'true');

        const options: CameraOptions = {
            sourceType: selectedSourceType,
            quality: iQuality,
            destinationType: this.camera.DestinationType.DATA_URL,
            correctOrientation: true,
            encodingType: this.camera.EncodingType.JPEG,
            mediaType: this.camera.MediaType.PICTURE,
            targetWidth: 1024,
            targetHeight: 1024,
            saveToPhotoAlbum: bSaveSet
        }

        if(this.platform.is('android'))
        {
            this.platform.ready().then(() =>
            {
                this.camera.getPicture(options).then((imageData) => {

                    // Object picture
                    this.oObject['picture'] = 'data:image/jpg;base64,' + imageData;
                    if(this.oObject['picture'] !== '')
                    {
                        this.forwardToElements();
                    }


                    // Replace button
                    this.replaceBtn();

                }, (err) => {

                    // Handle error
                    alert(err);

                });
            });
        }
    }

Im landing in this section:

}, (err) => {

     // Handle error
     alert(err);

});

The content on the alert is:
plugin_not_installed

But yes, in my package.json I’ve the plugin installed.

"@ionic-native/camera": "^3.12.1",
"cordova-plugin-camera": "^2.4.1",

Im wondering why it’s working in Ionic view app and not working in the debug .APK

Hope that some one can help me!

Does some one know’s a solution for this?

have you effectively installed the plugin?

Yes as I said in my start post I’ve installed the camera plugin.
It’s inside my package.json and the cordova plugin works in Ioniv View apps.

But it’s not working when I create a debug.apk

weird, maybe an option which would be missing or didn’t work?

in case of, here are mine, could config works on android and ios

    let popoverOptions: CameraPopoverOptions = {
        x: 0,
        y: 0,
        width: 1080,
        height: 1080,
        arrowDir: this.camera.PopoverArrowDirection.ARROW_ANY
    };

    let options: CameraOptions = {
        quality: 90,
        destinationType: this.camera.DestinationType.FILE_URI,
        sourceType: sourceType,
        allowEdit: false,
        encodingType: this.camera.EncodingType.JPEG,
        targetWidth: 1080,
        targetHeight: 1080,
        mediaType: this.camera.MediaType.PICTURE,
        correctOrientation: true,
        saveToPhotoAlbum: false,
        cameraDirection: this.camera.Direction.BACK,
        popoverOptions: popoverOptions
    };

Note I used FILE_URI not DATA_URL but well I don’t think that’s the reason why the plugin isn’t found…

I’m using DATA_URL because that is returning a base64-encoded string.
I’m using that because my application has to work offline so I’m storing the base64 in a SQLite table.

Yep, but I mean maybe one of the other option?

Have you also already try to reinstall the plugin?

ionic cordova plugin remove cordova-plugin-camera --save
ionic cordova plugin add cordova-plugin-camera --save

Yeah already tried.

Should not make a difference.

well then for my part I’ve got not more ideas. options you says it’s ok, reinstall you says you did…you have all edit-config tags in your config.xml? I know it has nothing to do with android but with an iOS quirks, but when some weird stuffs happens, who knows https://github.com/apache/cordova-plugin-camera

and have you try to delete your app on your phone first before installing the new apk? well again make no sense, but who knows

Yes, before installing the new .APK I delete the old app.

Yes in my config.xml is the reference for the camera plugin with the same version as in my package.json.

<plugin name="cordova-plugin-camera" spec="^2.4.1" />

maybe try a newer version of the plugin? actual version is 3.0.0 … don’t know which cordovan-android you are using and if compatible…just check before

 <plugin name="cordova-plugin-camera" spec="^3.0.0" />
 <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>need camera access to take pictures</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
    <string>need to photo library access to get pictures from there</string>
</edit-config>
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>need location access to find things nearby</string>
</edit-config>
<edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
     <string>need to photo library access to save pictures there</string>
</edit-config>
2 Likes

I would try.
Going to update everything now.

2 Likes

finger crossed, good luck

maybe in the meantime someone would be cleverer than me and bring a better idea…

1 Like

I think it will work. Tried so much else. I will keep you in touch!
Thanks for helping and giving me a fresh sight on this problem.

Hi @reedrichards,

Fixed this issue by updating it to the version you mentioned.
Thanks for your help, appreciate it.

I will mark your answer as solution.

1 Like

Awesome, good to hear you solved it!

Hello, I have got the similar issue with paypal plugin, the paypal works when i run the app on devapp but when i build an apk and run in my device i get “plugin_not_installed” can you help if you know about this problem as well.