0

I need to transfer image to server captured via camera "without storing it into internal or external storage" due to security reasons. Please Help!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Vipin Sharma
  • 594
  • 5
  • 19

2 Answers2

0

For this you need to connect the android app to a web service by storing it in memory in a Bitmap variable in memory and destroy it after the code is used or image is sent to the server.

Shadab K
  • 1,677
  • 1
  • 16
  • 25
0

You can use Camera#takePicture(...) that will return the picture taken as a byte array through PictureCallback.

Here is a pseudo code that takes a picture.

Camera.ShutterCallback shutterCallback = () -> Log.i("Shutter has been triggered");
Camera.PictureCallback rawCallback = (data, camera) -> Log.d("Picture has been taken.");
Camera.PictureCallback jpegCallback = (data, camera) -> {
        // Do something with the picture here.
    };

Camera camera = Camera.open();
camera.startPreview();
camera.takePicture(shutterCallback, rawCallback, jpegCallback)

Please note that this sample uses the "old" Camera V1 API, which is very different of Camera V2 API. You can check this post for a full diff of those 2 APIs

Louis
  • 1,913
  • 2
  • 28
  • 41