M
M
MADSMILEXD2018-08-09 13:19:44
Android
MADSMILEXD, 2018-08-09 13:19:44

How to update camera code for target sdk 26?

Now the project uses targetSdk 22, there is a method for requesting a camera:

public static Camera getCameraInstance(int i)
    {
        Camera camera;
        try
        {
            camera = Camera.open(i);
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
            return null;
        }
        return camera;
    }

but starting from August of this year, google play does not accept apk where the sdk target is below 26, but the fact is that when you change the version to 26 when you start the camera, the application crashes ... what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Chvarkov, 2018-08-09
@MADSMILEXD

Caller "mfilters.future.photo.editor" (PID 10272, UID 6426) cannot open camera "0" without camera permission'

You don't have camera permission. Read about runtime permissions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question