Infinite picture taking until cancel is pressed?


#1

Hi,

I’m working on an app at the moment that required at least 4 pictures are taking. I’m trying to restart the camera every time a picture is taken so they don’t have to click the take picture button again on the app menu. Here is my code so far:

  startCamera() {
    if(this.pictureList.length >= 4) {
      this.alertController.create({
        title: this.singleton.TITLE_ERROR,
        message: this.singleton.MESSAGE_TOOMANYPHOTOS,
        buttons: [
          {
            text: 'Ok',
          }
        ]
      }).present();
      return;
    }

    let imageData = "";
    this.camera.getPicture(this.options).then((imageData) => {
      this.pictureList.push(imageData);

      let temp = [];
      for (let i of this.pictureList) i && temp.push(i);

      this.pictureList = temp;
      this.slides.refresh();
    }, (err) => {
      console.log(err);
    });
  }

However, the camera does not restart back into the camera? Is there any reason why this wouldn’t work? I’m thinking it’s do to with a me trying to call a function inside of a promise?