Problem adding Photo Viewer

This post was flagged by the community and is temporarily hidden.

Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add com-sarriaroman-photoviewer
$ npm install --save @ionic-native/photo-viewer

In your ts:

import { PhotoViewer } from ‘@ionic-native/photo-viewer’;

constructor(private photoViewer: PhotoViewer) { }

and you can use it this way:‘’);‘’, ‘My image title’, {share: false});

Then you can use it… If you get an error do the import in app.module.ts and add the SpaceName in the providers section

Why do you think that?

Not sure but when I used it, my console.log show it run but PhotoViewer doesn’t open and I already followed all the instructions on how to add it and implement it on ts.

I did it all already but it’s still not working.

The output you got above is normal. There is nothing wrong with installation.

Do you have both in package.json?
Did you also install the Cordova plugin?
How are you testing you app?

Post your ionic info output.

Sorry my knowledge on developing app is very basic… Now I know it’s normal, lol.

How do I check package.json ? I don’t know how
Installed Cordova plugin :

C:\Projects\myApp>cordova plugin ls
com-sarriaroman-photoviewer 1.1.10 "PhotoViewer"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

How are you testing you app? Using ionic serve
Ionic info:

cli packages: (C:\Projects\myApp\node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0


    Node : v6.11.2
    npm  : 3.10.10
    OS   : Windows 10

Open the file. It’s in the main folder of your project.

This won’t work. Ionic Native and Cordova plugins are only available in native environments, you will have to use ionic cordova build android or ionic cordova build ios to build the app for the native platform and test it in an emulator or on a real device.

That looks great.

1 Like

I did open my project file and search package.json and there’s a lot.

So I need to install Android SDK right to build the apk file ? Cause I try to build it without Android SDK and it failed. Is there any other way for me to install it without installing the full Android Studio package, cause I know the software update a lot and eat a lot of space.

Thanks for helping, you a savior! :star_struck::+1::star_struck::+1:

No, Android Studio is needed. Run cordova requirements to see if everything is installed properly to build for Android.

Alright, I will get that done and installed.