Giter Club home page Giter Club logo

Comments (4)

kevalpatel2106 avatar kevalpatel2106 commented on June 30, 2024

@alexadp1087 Did you asked for the write external storage runtime permission before taking the picture?

from android-hidden-camera.

kevalpatel2106 avatar kevalpatel2106 commented on June 30, 2024

Closing the issue because of inactivity. If you face the same issue feel free to reopen this.

from android-hidden-camera.

dengue8830 avatar dengue8830 commented on June 30, 2024

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)

image

I'm using HiddenCameraFragment

from android-hidden-camera.

dengue8830 avatar dengue8830 commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.