Comments (7)
Thanks for your time @breautek . From my observation, I guess it is due to app state being killed by android to save ram when we switch to the camera app. As a word around I had made the app as a background process while capturing the image so that the state remains. As a permanent fix, I would consider using a native app camera plugin instead of going through the camera app.
Thanks again
from cordova-plugin-media-capture.
Glad we got to the bottom of this and that you've discovered some solutions.
FYI that gotcha is also documented as an android quirk at https://github.com/apache/cordova-plugin-media-capture#android-lifecycle-quirks
So listening to the pendingcaptureresult
event may also be a workaround.
I'm not 100% sure if using a background process is a reliable solution or not, I think the phone (although maybe more forgiving) may still kill the app activity.
Using the native camera APIs instead of interfacing through the camera app has their own set of problems, particularly with permissions that are treated as "dangerous". So I would vote negative on adding camera API support as a part of this plugin.
Please let me know if this issue can be considered as close or not.
from cordova-plugin-media-capture.
Please include your environment detail and versions for
- cordova cli version
- cordova-android
- installed android sdk
- target sdk (if overwritten)
- cordova-plugin-media-capture version
- android os version
and please include the code snippet that is causing this stacktrace.
thanks
from cordova-plugin-media-capture.
cordova-android:@8.0.0
[email protected]
cordova-plugin-media-capture [email protected]
androidversion@9
navigator.device.capture.captureImage(image => {
let win: any = window;
win.resolveLocalFileSystemURL(
image[0].fullPath,
fileEntry => {
fileEntry.file(
file => {
let data = new FileReader();
data.onloadend = () => {
console.log(data.result);
let blob = new Blob([data.result]);
this.kycData[code].httpCall = true;
this.cd.detectChanges();
this.kycService
.uploadKyc(type, blob, image[0].name)
.subscribe(
(res: any) => {
if (res.status) {
this.processUpload(code);
}
},
err => {
err.status === 0
? this.presentToast("Please Check your Connection")
: this.presentToast(
typeof err.error === "string"
? err.error
: err.error.message
);
console.log(err);
}
)
.add(() => {
this.kycData[code].httpCall = false;
this.cd.detectChanges();
});
};
data.readAsArrayBuffer(file);
},
err => {
console.log(err);
}
);
},
err => {
console.log(err);
}
);
}, (err) => {
console.log(err)
});
from cordova-plugin-media-capture.
the error is triggered from file capture.java from this method
private JSONObject createMediaFile(Uri data) {
File fp = webView.getResourceApi().mapUriToFile(data);
JSONObject obj = new JSONObject();
Class webViewClass = webView.getClass();
Here there is no null check for the input being passed from onImageActivityResult method also iam sure why the imageUri is being null after capturing the image. Because of that null exception it is crashing the app
from cordova-plugin-media-capture.
Thanks for your information. This is to determine and ensure everything is up to date. cordova-android
is missing a minor release, but I don't believe this is significant here.
Here there is no null check for the input being passed from onImageActivityResult method also iam sure why the imageUri is being null after capturing the image.
Yes, but even if we add a null check, I don't think it will solve the main problem which is the image uri being null in the first place unexpectedly.
I'm not very familiar with this codebase but bear with me. The next steps to move this forward I think is to create a reproduction app that contains the minimal code required to reproduce this issue. Ensure to include only what is necessary (no ionic or other frameworks, just pure cordova and the plugins required to reproduce the issue).
I have an android 9 device that I can use to test and hopefully reproduce.
https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md
from cordova-plugin-media-capture.
Any solution for 2020? We're getting this error with:
cordova-android:@9.0.0
cordova-plugin-media-capture version@master
androidversion@10
targetSdk 29
from cordova-plugin-media-capture.
Related Issues (20)
- Are there any VideoCapture Started and VideoCaptureStopped events to subscribe? HOT 1
- About dependency plugin requirement "cordova-plugin-file@^4.0.0" HOT 1
- ios after capture
- Plugins are missing dependencies HOT 1
- Get frame(s) from Video stream
- Vite Rollup Error using plugin in react vite app HOT 1
- Android permission denied When opening the camera HOT 10
- Provide the ability to store capture files in private app storage rather than external storage HOT 6
- when i set duration 15sοΌit not work in HarmonyOs
- Types of parameters 'data' and 'value' are incompatible HOT 1
- Recording interface is broken HOT 4
- Can anything be done at all about the extremely ugly and awkward audio recording UI on IOS? HOT 2
- Android 13 support Targetting SDK 33 HOT 8
- Version 5.0.0 requires Android 12 and Node 16 HOT 5
- On android 13 api level 33 plugin gives permission denied error HOT 1
- App crashes on Android 13 when starts recording a video HOT 1
- cordova-plugin-media-capture video not working android 13 HOT 7
- [Android] Support "partial access to photos and videos" for devices running Android 14 HOT 1
- [Android] Remove broad photo/video permissions and use a system picker - Google Play Policy deadline 2024-08 HOT 2
- Cant get access to media file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-media-capture.