Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start camera for both take picture OR record video

I googled for 2 weeks to find what I want. However, I am not able to find answer to my question and I have no idea how it could be done by Google Photos developers. The screenshots below are from Google Photos app.

When I click Take a photo, it starts(or opens) the camera and allows to take pictures OR record videos. I can also start camera to take picture and record video in different intents using following codes:

startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), ACTION_TAKE_PICTURE_RESULT_CODE);
startActivityForResult(new Intent(MediaStore.ACTION_VIDEO_CAPTURE), ACTION_TAKE_VIDEO_RESULT_CODE);

Those lines works without any bug/problem. But my question is, how to start camera to take pictures OR record videos?

I hope my problem(question) is clear.

first second

like image 802
Mirjalal Avatar asked Oct 18 '22 12:10

Mirjalal


1 Answers

But my question is, how to start camera to take pictures OR record videos?

You don't, if you want to get the result. There is no ACTION_IMAGE_OR_VIDEO_CAPTURE, for example. You would need to allow the user to choose what to do before starting ACTION_IMAGE_CAPTURE or ACTION_VIDEO_CAPTURE.

I have no idea how it could be done by Google Photos developers. The screenshots below are from Google Photos app.

Your question has nothing to do with Google Photos. After all:

  • Not every device has Google Photos installed
  • Not every device that has Google Photos installed has it enabled
  • Not every device that has Google Photos installed and enabled has it available to the user (e.g., restricted profiles)
  • The user might still choose some other app to handle your Intent, if the user has other camera apps installed
like image 87
CommonsWare Avatar answered Oct 21 '22 08:10

CommonsWare