Menu

Different projects yielding different number of cameras

Q&A
Anonymous
2021-08-06
2021-08-07
  • Anonymous

    Anonymous - 2021-08-06

    Hello,

    First of all, great app! Works well and there is a great community behind
    it.

    I have a fairly technical question about the source code.

    I want to implement a rear camera switcher just like in Open Camera with
    the Camera 2 API. On my OnePlus 7 Pro and OnePlus 7T, the app queries all
    the available cameras just find and can cycle through them.

    I have read and dropped in logs in the source and know that it is querying
    the available cameras with this:

            CameraManager manager =
    (CameraManager)context.getSystemService(Context.CAMERA_SERVICE);
            try {
                return manager.getCameraIdList().length;
            }
    

    It returns 4 ids, one for each camera, like I would expect on both devices.

    Great. So I try to do the exact same thing as this code (and as suggested
    by official documentation) in my project. But weirdly enough, I get only 2
    ids for the same devices, not letting me query for the other ones in any
    way.

    What could possibly explain this? Our build.gradles are similar. Same
    target SDK, compile SDK, different min SDK however, but CameraManager
    requires API 21 at least anyway.

    Thanks for any help,
    Steven P

     
    • Mark

      Mark - 2021-08-07

      I've no idea why this might be I'm afraid.

      As a stab-in-the-dark - is it affected by the package name (e.g., changing Open Camera's code to use a different package name)?

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.