I need to transfer image to server captured via camera "without storing it into internal or external storage" due to security reasons. Please Help!
Asked
Active
Viewed 68 times
0
-
3Share what you've tried so far. – tahsinRupam Dec 14 '17 at 10:17
-
Why dont you just store it, upload it, delete it? – Aswin P Ashok Dec 14 '17 at 10:17
-
Make it base64 string and send it, that way you don't need to store it. – 476rick Dec 14 '17 at 10:18
2 Answers
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