Camera plugin is working or not

Here’s a snippet of my code. I wasn’t able to test this code, so pls use it as a reference…

Used packages:

    "@ionic-native/camera": "4.5.3",
    "@ionic-native/core": "4.5.3",
    "cordova-plugin-camera": "^4.0.2",

Example:

import { Camera, CameraOptions } from "@ionic-native/camera";
import { File } from "@ionic-native/file";

...

export class MyPage{
  private fileName: string;
  private imgSrc: any;
  private cameraOptions: CameraOptions = {
    cameraDirection: this.camera.Direction.BACK,
    correctOrientation: true,
    destinationType: this.camera.DestinationType.FILE_URI,
    encodingType: this.camera.EncodingType.JPEG,
    mediaType: this.camera.MediaType.PICTURE,
    quality: 100,
    sourceType: this.camera.PictureSourceType.CAMERA,
    targetHeight: 1280,
    targetWidth: 1280,
  };

  constructor(private camera: Camera, private file: File) { }

  public getPicture(){
      let currentName: string;
      let correctPath: string;
      this.camera.getPicture(this.cameraOptions)
          .then((imagePath) => {
            // cleaning/formatting the filename
            currentName = imagePath.substr(imagePath.lastIndexOf("/") + 1);
            -1 !== currentName.indexOf("?") ?
              currentName = currentName.substr(0, currentName.lastIndexOf("?")) :
              null;

            correctPath = imagePath.substr(0, imagePath.lastIndexOf("/") + 1);
            return this.file.resolveLocalFilesystemUrl(correctPath);
          }, (err) => {
            reject("Error while selecting image.");
          })
          .then((res: any) => {
            if (res) {
              this.fileName = currentName; // if you might need it
              this.imgSrc = res.nativeURL + currentName;
            } else {
                console.log("Couldn't resolve localFileSystemUrl");
            }
          });
      })
        .catch((err) => {
          console.error("No item selected", err);
        });
   }
}