Unable to call native camera plugin at startup in Production mode

I am creating a camera app using the native camera app. The app runs fine in development mode but as soon as I run it in prod mode the app does not call the native app in constructor and directly loads the page that is supposed to show the image.
Now I am confused if I should call the plugin in constructor or somewhere else. I believe that the plugin gets called before the app is ready causing the issue but I am not sure. Has anyone experienced the same problem? Am I doing something wrong?

Please add some code.
But any way call the camera only after device ready

What does that mean? What do you do to “run it in prod mode”?

I am calling the open camera function in constructor of root component. Because of which as soon as the app starts the app should show the camera. The app works fine if I create a development apk and runs it on device but if I build it in production mode ith --prod flag it goes straight to the home component without taking image.

This is the code.

base64Image = "";

  constructor() {
    this.takePicture();
  }

  takePicture(){
    Camera.getPicture({
        destinationType: Camera.DestinationType.DATA_URL,
        targetWidth: 1000,
        targetHeight: 1000
    }).then((imageData) => {
      // imageData is a base64 encoded string
        this.base64Image = "data:image/jpeg;base64," + imageData;
    }, (err) => {
        console.log(err);
    });
  }