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

Camera plugin is not implement on Android (Capacitor Camera) when pairing with Capacitor-Community/Media #82

Closed
barbar-binks opened this issue Jan 25, 2024 · 5 comments

Comments

@barbar-binks
Copy link

Describe the bug
On Ionic / Angular -> I am trying to use the Media plugin as an alternative to choosing various photos and uploading them to a backend (using Capacitor Camera pickImages() function makes it complicated without a clear path to convert that image to a dataURL o Base64 string). So I am currently trying to implement Capacitor Camera for taking photos and Capacitor-Community/media for selecting photos.

the bug is that now that the Media plugin is installed, Capacitor Camera is throwing an error that "Camera is not implemented on Android)

Error from logcat here:

File: https://localhost/main.db46d93f1695260e.js - Line 1 - Msg: ERROR Error: "Camera" plugin is not implemented on android

To Reproduce
Steps to reproduce the behavior:
`
import { Camera, CameraDirection, CameraPermissionState, CameraResultType, CameraSource } from '@capacitor/camera';
import { Media } from '@capacitor-community/media';

async selectPhotos() {
const _self = this;
const result = await Media.getMedias({
types: "photos",
});
return result;
}`

Expected behavior
To be able to use Capacitor Camera and Capacitor-Community/media together.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Honor Magic5
  • OS: Android
  • Browser Ionic App
  • Version 13

Additional context
Add any other context about the problem here.

@barbar-binks
Copy link
Author

barbar-binks commented Jan 25, 2024

As additional information: I just realized that all capacitor plugins (Push Notifications, Google Maps, Camera, Haptics) throw "not implemented on android" error. If i uninstall and remove Media plugin, everything works.

@nkalupahana
Copy link
Collaborator

Sorry, but I'm unable to reproduce this. Both the example app and my company's app uses the Media plugin with many other plugins, and has never had an issue. It's likely that this has something to do with your specific setup. Try the troubleshooting steps here (there's a section specifically for "not implemented" errors): https://capacitorjs.com/docs/android/troubleshooting

@nkalupahana nkalupahana closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
@AntonERG
Copy link

AntonERG commented Oct 23, 2024

I guess I have same or similar issue.

Sample code:

import { Media, MediaAlbum } from '@capacitor-community/media';

async savePostcard(fileData: string) {
   const { albums } = await Media.getAlbums();   // CRASH on this line
   console.log(`#debug albums:\n${JSON.stringify(albums)}`);
 },

savePostCard('')

Console error:

index.66ebb300.js:1 Uncaught (in promise) Mp: "Media" plugin is not implemented on android
    at v (https://localhost/assets/index.66ebb300.js:1:69097)
    at https://localhost/assets/index.66ebb300.js:1:69230
    at async Proxy.savePostcard (https://localhost/assets/Map.6c21fb95.js:580:231322)

Plugin version: 5.4.1
Android version: 14

Same code works fine on iOS

@nkalupahana
Copy link
Collaborator

@AEiosApp I believe this is not an error with the Media plugin, but instead a problem with your specific app. Try the troubleshooting steps here (there's a section specifically for this "not implemented" error): https://capacitorjs.com/docs/android/troubleshooting

I can't help you debug your app specifically, but there are resources online (e.g. the Ionic Discord) where you can ask the community for help. If you have any problems with the plugin itself, please open a new issue!

@AntonERG
Copy link

@nkalupahana sorry, my fault, missed to define plugin in capacitor.congig.ts / includePlugins

Everything works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants