Hello,
<input type="file" accept="image/*;capture=camera">
is does not showing the options of camera in android platform, it is working in ios platform. please help me to solve this issue .
i am using ionic version 4.1.2,
Thanks
Hello,
<input type="file" accept="image/*;capture=camera">
is does not showing the options of camera in android platform, it is working in ios platform. please help me to solve this issue .
i am using ionic version 4.1.2,
Thanks
Depending on he version of Android you are testing on, this might not be supported. What is the android OS version you are deploying to?
thanks for reply,
i am deploying my app to android version 7.0.0
Hello! I am also facing this issue using the latest Ionic 5.0.7 and Capacitor 2.0.0.
It works fine using Chrome on Android to visit the webapp version of my Ionic project, but not when using the native app compiled with Capacitor. I can select previously taken pictures, but no option to use the Camera.
Anybody? I tried multiple values for the accept prop, still not showing up the camera on Android…
<input
type="file"
id="file-upload"
accept="image/*"
capture
@change="setImage"
/>
This works for me…
You mean it shows the Camera in the native app compiled for Android? I have the same exact code and it doesn’t on my side
Ionic V4:
Does this even work? I have no access to trigger event from HTML input type. The scenario is I have an angular web application as micro front end which is imported as web component in my ionic app. So all i have access is to change HTML of micro app:
i tried:
<input type="file" accept="image/*;capture=camera">
which is not working…
Can we trigger camera via input type file. by default it lunches the file browser of the whatever browsers it is clicked and in android as well it launches documents directory. However it doesn’t ask for an option to choose camera or gallery. is there a way to handle this type of scenario in android and ios platforms?
Yes it works, it just Javascript
For android its not working… it directly launches mobile documents
Are you using the EXACT same code as I posted? Your code looks different?
I still have this issue with Capacitor (The part where i’m able to select between browse for files and camera)
@aaronksaunders 's solution works, but it opens the camera directly, it doesn’t let the user choose.
According to the docs
<input type="file" accept="image/*;capture=camera">
should give the option to choose between browse files and open camera, but it doesn’t work on Capacitor (it works on mobile chrome though even without the capture in accept)
Any ideas ?
Thanks
It doesn’t work for me either. It always shows the file selection screen only without any option to capture from camera. No matter what combination I try:
<input type="file" accept="image/*;capture=camera" />
<input type="file" accept="image/*" capture="camera" />
<input type="file" accept="image/*" />
Doesn’t work on emulator (Android 11) or real phone (Android 12)
Ionic 6
Angular 13
What is the issue here?
doesn’t work for me either for Android 11
(Doesn’t work as android app, but works as web app accessed from Chrome)
(works on iPhone both as built app and web app.)
using Ionic 6 Vue3.
Added permission for camera on android. System log shows
Media capture intent could not be launched. Falling back to default file picker.
inline with
I am also seeing this problem across random phones.
Specifically Motorola Moto G31 ( Android 11 ) and the Pixel 5 Emulator ( Android 12 ).
It works fine on other Android devices including ones with the same Android version.
Could it be a specific WebView version causing these devices to fail?
As others have reported it all works fine from the native browser, just not within the App.
D/Capacitor: Unable to find a Capacitor plugin to handle permission requestCode, trying Cordova plugins 190163686
W/Capacitor/FileChooser: Media capture intent could not be launched. Falling back to default file picker.
I found the issue. The AndroidManifest needs the following
<queries>
<!-- Camera -->
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<!-- Gallery -->
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
</intent>
</queries>
It’s sill not working for me.
I use :
<input type="file" (change)="onFileChange($event)" accept="image/*,application/pdf;capture=camera" style="display: none;" #uploadFile/>
My AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="blabla">
<queries>
<!-- Camera -->
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<!-- Gallery -->
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
</intent>
</queries>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
It works on web app and on iOS
I have created a custom component to add a drop down menu on Android : Bitbucket
Feel free to use it.
None of the solutions presented here are working, which is baffling. It works fine out-of-the-box on iOS, but no chance to get it working on Android, no matter what I try. Neither in the emulator, nor on the physical device.
<input type="file" ...>
<queries>...</queries>
section to the AndroidManifest.xml
as suggested by @jcroucherandroid.permission.CAMERA
, android.permission.READ_MEDIA_IMAGES
, android.permission.READ_EXTERNAL_STORAGE
and android.permission.WRITE_EXTERNAL_STORAGE
to the AndroidManifest.xml
Android only presents me a dialog to pick an existing file, but no chance to capture from the camera.
It would be nice if the Ionic Team could help out here @mhartington - What are we doing wrong? Why is it working on iOS but not on Android? What should we do to make it work on Android?
Thank you.
Thank you very much for this solution / work-around. I used it in my project aswell. Do you have PayPal so I can drop you a little donation?