Take picture with front camera in android service

Emma22

I need to take a picture with the back camera in an android service but after reading the docs it seems you need a SurfaceView is it possible to take a picture without showing anything to the user?

Edit: Will this work?

SurfaceTexture surfaceTexture = new SurfaceTexture(10);
Camera camera = Camera.open();
camera.getParameters().setPreviewSize(1, 1);
camera.setPreviewTexture(surfaceTexture);
camera.startPreview();
camera.takePicture(null, pictureCallback, null);
rajan.kali

You can set Width and Height of SurfaceView to 1dp and margintop to -10,so that it wont display it on screen but it functions as normal and you can Take picture without displaying Surface View to User

<SurfaceView
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_marginTop="-10dp"
 ...
/>

in that case you can just use SurfaceTexture

   SurfaceTexture surfaceTexture = new SurfaceTexture(10);
    Camera camera = Camera.open();
    camera.getParameters().setPreviewSize(1, 1);
    camera.setPreviewTexture(surfaceTexture);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android using front facing camera to take a picture

From Dev

Android Camera2 : can't take picture with front camera

From Dev

Android - take picture - pass uri to camera app

From Dev

Android - take picture - pass uri to camera app

From Dev

ANDROID STUDIO: Take picture with Camera API -> Send this picture to another activity

From Dev

front camera take very dark capture in android

From Dev

Android: take camera picture intent remove confirmation dialog

From Dev

Take picture only with android camera intent in Kotlin, not video

From Dev

Android Tablet Take Picture Camera Intent Activity Restarts

From Dev

android: camera is not taking a picture

From Dev

How to use flash to take picture on custom camera?

From Dev

Take a camera picture and send it to php server in iPhone

From Dev

Take picture with camera and send with GWT uploader

From Dev

How to use flash to take picture on custom camera?

From Dev

Take a picture with react-native-camera

From Dev

Android 2.2 front camera

From Dev

Can we use takePicture() in android without camera preview? I need to take a picture secretly for security purposes

From Dev

Rotating picture from android camera

From Dev

Android - Take picture without preview

From Dev

Android OpenCV - CameraBridgeViewBase take picture?

From Dev

Take new picture action on Android

From Dev

Take picture continuously with autofocus in android

From Dev

Switch To Front Camera and Back Camera Android SurfaceView

From Dev

Android Camera2 front camera

From Dev

Android camera to take multiple photos

From Dev

android take multiple image with camera

From Dev

ZXing android use front camera

From Dev

Open front camera in Android >5.1

From Dev

Take picture from webcam or mobile camera in web applications

Related Related

  1. 1

    Android using front facing camera to take a picture

  2. 2

    Android Camera2 : can't take picture with front camera

  3. 3

    Android - take picture - pass uri to camera app

  4. 4

    Android - take picture - pass uri to camera app

  5. 5

    ANDROID STUDIO: Take picture with Camera API -> Send this picture to another activity

  6. 6

    front camera take very dark capture in android

  7. 7

    Android: take camera picture intent remove confirmation dialog

  8. 8

    Take picture only with android camera intent in Kotlin, not video

  9. 9

    Android Tablet Take Picture Camera Intent Activity Restarts

  10. 10

    android: camera is not taking a picture

  11. 11

    How to use flash to take picture on custom camera?

  12. 12

    Take a camera picture and send it to php server in iPhone

  13. 13

    Take picture with camera and send with GWT uploader

  14. 14

    How to use flash to take picture on custom camera?

  15. 15

    Take a picture with react-native-camera

  16. 16

    Android 2.2 front camera

  17. 17

    Can we use takePicture() in android without camera preview? I need to take a picture secretly for security purposes

  18. 18

    Rotating picture from android camera

  19. 19

    Android - Take picture without preview

  20. 20

    Android OpenCV - CameraBridgeViewBase take picture?

  21. 21

    Take new picture action on Android

  22. 22

    Take picture continuously with autofocus in android

  23. 23

    Switch To Front Camera and Back Camera Android SurfaceView

  24. 24

    Android Camera2 front camera

  25. 25

    Android camera to take multiple photos

  26. 26

    android take multiple image with camera

  27. 27

    ZXing android use front camera

  28. 28

    Open front camera in Android >5.1

  29. 29

    Take picture from webcam or mobile camera in web applications

HotTag

Archive