Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
The camera is the powerful tool and most Android-powered devices already have at least one camera installed. After sparing some time from taking selfies (most important use of camera ever known), we can also use it for many other purposes.
From a seller(E-commerce) point of view, he can add a new product from his application by adding product details and beautiful pictures taken from his camera.
In this post, we are going to take images from the camera and will upload to the PHP web server using multipart connection type.
We will use an existing camera application (that is bundled with all android devices having a camera).
Default  camera app itself gives us the ability to review/retake the image, and once an image is accepted.
to allow only those devices which contain built-in camera functionality.
As we know from Marshmallow 6.0 Permission policies are changed thus Permissions are requested on runtime.
Action “android.provider.MediaStore.ACTION_IMAGE_CAPTURE” Â is used to invoke the native Camera of the device.
Now We will Override the onActivitityResultÂ
We will receive a Bitmap of data that we store in a temporary file. This temporary file is uploaded afterwards.
Notice that the image returned by the camera application is passed as an extra named ‘data’ through to the intent of the calling activity. This ‘data’ is a Bitmap object.
Hot Served uploadFileToServerTask uploads the file to PHP server using multipart connection type.
For Further Reading:
http://developer.android.com/reference/android/hardware/Camera.html
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.