Comments (4)
@alexadp1087 Did you asked for the write external storage runtime permission before taking the picture?
from android-hidden-camera.
Closing the issue because of inactivity. If you face the same issue feel free to reopen this.
from android-hidden-camera.
Hi! i have the same issue. In android 6 it works, but in android 4 throws an ERROR_IMAGE_WRITE_FAILED
03-07 16:54:31.011 8220-8369/com.taxip.app W/System.err: java.io.IOException: open failed: EINVAL (Invalid argument)
03-07 16:54:31.011 8220-8369/com.taxip.app W/System.err: at java.io.File.createNewFile(File.java:950)
03-07 16:54:31.011 8220-8369/com.taxip.app W/System.err: at com.androidhiddencamera.HiddenCameraUtils.saveImageFromFile(HiddenCameraUtils.java:138)
03-07 16:54:31.011 8220-8369/com.taxip.app W/System.err: at com.androidhiddencamera.CameraPreview$1$1.run(CameraPreview.java:217)
03-07 16:54:31.011 8220-8369/com.taxip.app W/System.err: at java.lang.Thread.run(Thread.java:841)
03-07 16:54:31.012 8220-8369/com.taxip.app W/System.err: Caused by: libcore.io.ErrnoException: open failed: EINVAL (Invalid argument)
03-07 16:54:31.012 8220-8369/com.taxip.app W/System.err: at libcore.io.Posix.open(Native Method)
03-07 16:54:31.012 8220-8369/com.taxip.app W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
03-07 16:54:31.012 8220-8369/com.taxip.app W/System.err: at java.io.File.createNewFile(File.java:943)
03-07 16:54:31.012 8220-8369/com.taxip.app W/System.err: ... 3 more
and the permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
its a android 4 so i don't need to request permissions on run time (for location works in that way).
i have checked with this
Log.i("camera", (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) + ""); // true
Log.i("write", (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) + ""); // true
Log.i("read", (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) + ""); // true
i tried to take pictures with the android's front and back camera app and it works fine (so camera works and there is enough space)
This is what i get debugging the method: saveImageFromFile at line 138 from the HiddenCameraUtils class (where the error come from)
I'm using HiddenCameraFragment
from android-hidden-camera.
i could reproduce the problem using the file path shown in the debug console
file name: /storage/sdcard0/Android/data/com.taxip.app/cache:IMG_1520453738411.jpeg
problem: open failed: EINVAL (Invalid argument)
the filename is invalid in that android's version
File file = new File("/storage/sdcard0/Android/data/com.taxip.app/cache:IMG_1520453738411.jpeg");
try {
boolean result = file.createNewFile();
Log.i("ok?", result + "");
} catch (IOException e) {
Log.e("writing error", e);
}
if i change the ':' for a '_' it works
from android-hidden-camera.
Related Issues (20)
- Unhandled RuntimeException exception causing app crash
- permission denied for window type 2006 HOT 2
- com.androidhiddencamera.CameraPreview not attached to window manager HOT 1
- Burst/multiple images? HOT 1
- java.lang.RuntimeException: getParameters failed (empty parameters) HOT 1
- Using External Camera
- How to capture Image in Service?? HOT 2
- Take multiple photo background HOT 1
- [ASK] kotlin usage
- How to use in higher version like oreo HOT 2
- Handling Camera Not Open Error Case
- Ask for Streaming HOT 1
- Capture Image From Back Camera
- How to Clear Cache after taking picture?
- ERROR_CAMERA_OPEN_FAILED
- Background camera not initialized. Call startCamera() to initialize the camera. HOT 1
- Running Service using Periodic workmanager, the device hangs after some time HOT 2
- Compatibility with Android 10
- java.lang.RuntimeException: takePicture failed HOT 4
- Bugy library
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 android-hidden-camera.