Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Camera plugin "Unable to create photo on disk" and CameraSource.Prompt missing promptLabelHeader #4514

Closed
hembachrterran opened this issue Apr 30, 2021 · 4 comments

Comments

@hembachrterran
Copy link

hembachrterran commented Apr 30, 2021

Bug Report

Using Capacitor Camera plugin with Android:

  • The promptLabelHeader option is set, but it doesn't show on the top of the promt.
  • Error if select the Camera option from the Prompt: "Unable to create photo on disk".

The test device runs on Android 10.

Capacitor Version

Latest Dependencies:

@capacitor/cli: 2.4.7
@capacitor/core: 2.4.7
@capacitor/android: 2.4.7
@capacitor/electron: 2.4.7
@capacitor/ios: 2.4.7

Installed Dependencies:

@capacitor/ios not installed
@capacitor/cli 2.4.7
@capacitor/android 2.4.7
@capacitor/core 2.4.7
@capacitor/electron not installed

Ionic info

Ionic Framework : @ionic/angular 5.3.2
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3

Platform(s)

[ x ] Android (Android 10)

OS of the development machine

[ x ] Windows 10

Code Reproduction

AndroidManifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

req Perm:

this.androidPermissions.requestPermissions([
      this.androidPermissions.PERMISSION.CAMERA,
      this.androidPermissions.PERMISSION.READ_EXTERNAL_STORAGE,
      this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE]);

import:
import { Plugins, CameraResultType, CameraSource } from '@capacitor/core';

function:

async takePicture() {
    const image = await Plugins.Camera.getPhoto({
      quality: 100,
      allowEditing: false,
      resultType: CameraResultType.DataUrl,
      source: CameraSource.Prompt,
      saveToGallery: false,
      promptLabelCancel: 'Mégsem',
      promptLabelHeader: 'Kép hozzáadása',
      promptLabelPhoto: 'Fotó kiválasztása',
      promptLabelPicture: 'Fényképezés'
    });

    let securedImage = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl));
  }

Other Technical Details

npm --version output:

npm --version
6.9.0

node --version output:

node --version
v12.6.0
@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Apr 30, 2021
@Ionitron
Copy link
Collaborator

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@hembachrterran
Copy link
Author

hembachrterran commented May 2, 2021

Hi,
I created a Sample app with Ionic Starter:
https://github.com/hembachrterran/sample-cap-camera-app

I found the Camera error "Unable to create photo on disk" caused by I removed these lines from AndroidManifest.xml to use a Cordova Document Scanner plugin (due to a manifest merge problem):

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
</provider>

You can check this case in the sample app.

The other problem that the promptLabelHeader is missing from the promt is still exists.

@Ionitron Ionitron removed the needs reply needs reply from the user label May 2, 2021
@jcesarmobile
Copy link
Member

jcesarmobile commented May 3, 2021

Yeah, you need the document provider, otherwise the plugin doesn't work.

About the promptLabelHeader, it's documented that it's iOS only, same as promptLabelCancel
https://capacitorjs.com/docs/apis/camera#cameraoptions

If you update to Capacitor 3-rc.1 and use @capacitor/camera plugin it was implemented there

@jcesarmobile jcesarmobile removed the needs reproduction needs reproducible example to illustrate the issue label May 3, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants