简体   繁体   中英

Camera intent open the camera app (only the first time)

Here is the context :
In my app, I need to capture images, that's why I use camera intent.
This feature works perfectly, but only if the camera app was already been opened once before
Indeed, this issue appears only on a new device, or a new emulator

Here is the problem :
When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures. That's not the camera app IN my app, but the camera app alone. I need to close this camera app, back to my app, and trying again
When I visit the camera app at least one time in the device's life, there is no issue

Here is what I'm looking for :
I want this camera app open in my app, even if it's the first time

I use the classic and official way to captures images

https://developer.android.com/training/camera/photobasics

EDIT
I think the problem is because at the first time, the camera app asked for the location permission. So we need to open the intent without asking this permission, to keep the focus

When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures.

There are ~26,000 Android device models. These ship with dozens, if not hundreds, of different pre-installed camera apps. The behavior of any of those apps on first run of that app will vary by app. Moreover, the decision of how those apps behave when they are first run is up to the developers of those apps, not you or me.

That's not the camera app IN my app, but the camera app alone

It is never "IN [your] app" if you are using ACTION_IMAGE_CAPTURE , as your question suggests that you are. It is always a third-party app, one of many pre-installed ones, or one of the user ones. And, again, the behavior of those apps are up to their respective developers.

I want this camera app open in my app, even if it's the first time

Sorry, but that is not under your control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM