Skip to content

Camera does not offer tick nor cross to accept photo after accepting permissions and taking photo #161

Open
@Sam-Davis

Description

@Sam-Davis

Which platform(s) does your issue occur on?

Android

  • emulator or device. What type of device?
    I have tried this on 5 different emulator devices

Please, provide the following version numbers that your issue occurs with:

  • CLI: 5.0.1
  • Cross-platform modules: 4.0.1
  • Runtime(s): 4.0.1
  • Plugin(s):
    "dependencies": {
    "@angular/animations": "~5.2.0",
    "@angular/common": "~5.2.0",
    "@angular/compiler": "~5.2.0",
    "@angular/core": "~5.2.0",
    "@angular/forms": "~5.2.0",
    "@angular/http": "~5.2.0",
    "@angular/platform-browser": "~5.2.0",
    "@angular/platform-browser-dynamic": "~5.2.0",
    "@angular/router": "~5.2.0",
    "nativescript-angular": "~5.3.0",
    "nativescript-background-http": "^3.3.1",
    "nativescript-camera": "^4.0.2",
    "nativescript-imagepicker": "^6.0.5",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "^1.4.6",
    "nativescript-ui-sidedrawer": "~4.0.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "~5.5.5",
    "tns-core-modules": "^4.0.1",
    "zone.js": "~0.8.18"
    },
    "devDependencies": {
    "@angular/compiler-cli": "~5.2.0",
    "@ngtools/webpack": "~1.9.4",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "clean-webpack-plugin": "~0.1.19",
    "codelyzer": "~4.0.2",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "~1.5.0",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.10.0",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "sass-loader": "~6.0.6",
    "tslint": "~5.8.0",
    "typescript": "~2.7.2",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0"

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

The first time the camera is loaded on an emulator, the user is asked for permissions. The standard permissions to access the device camera are requested, but unexpectedly the user is also asked if they want the device to have access to their location.

Whether or not the user agrees to allow the app to have access to their location, the next screen is the take photo screen (as expected). However, when the user clicks on the camera icon to take a photo, they are not shown the tick or cross asking them if they want to keep the photo. Instead the camera button displays and they can continue taking photos indefinitely.

If the user presses the back button and goes into this screen again, then the user is redirected to the page with the tick and the cross as expected.

I'm guess that this is caused by a race condition, where the take photo starts before all the permissions are approved.

The code to take the photo appears to be waiting for the permissions to have been granted:

 camera.requestPermissions().then(
     function success() {
         var options = { width: 300, keepAspectRatio: true, saveToGallery: true };
         var takePictrue = camera.takePicture(options);
         takePictrue.then((imageAsset: ImageAsset) => {
...

I have asked this question on stack overflow: https://stackoverflow.com/questions/54197418/nativescript-camera-doesnt-show-tick-nor-cross-after-taking-a-photo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions