Start a new topic

Unable to open camera using SDK 7 Eample


Using the example for SDK 7 on  Android Studio 2.3 

Was unable to open the camera although the code works with WIkitude Logo appearing.

Please see below.

public class MainActivity extends AppCompatActivity {

    public ArchitectView architectView;


    protected void onCreate(Bundle savedInstanceState) {



        this.architectView = new ArchitectView(this);


        final ArchitectStartupConfiguration config = new ArchitectStartupConfiguration();


// config.setCameraPosition("back"); // The default camera is the first camera available for the system.

// config.setCameraResolution(sampleData.getCameraResolution()); // The default resolution is 640x480.

// config.setCameraFocusMode(sampleData.getCameraFocusMode()); // The default focus mode is continuous focusing.

// config.setCamera2Enabled(sampleData.isCamera2Enabled()); // The camera2 api is disabled by default (old camera api is used).

// config.setFeatures(sampleData.getArFeatures()); // This tells the ArchitectView which AR-features it is going to use, the default is all of them.


        this.architectView.onCreate( config );





    protected void onPostCreate(@Nullable Bundle savedInstanceState) {



        try {

            //If authorisation not granted for camera

            if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)

                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 50);


            this.architectView.load( "01_ImageTracking_2_DifferentTargets/index.html" );

        } catch(Exception ex ) {





Hello YT Ho,

Please make sure that you have set the correct permissions in order to allow the camera to access your app. Have a look at the code inside the files AndroidManifest.xml and info.plist. Also, please follow our documentation section here.



Hi YT Ho,

Can you please also send the AndroidManifest.xml so we can check if the Permissions are correct?

Thx and greetings



Hi Nicola,

Kindly find the fie attached.




Hi YT,

In the snippet you added to your question you are missing ArchitectView lifecycle calls. 

You have to call onCreate/onPostCreate/onResume/onPause/onDestroy in the equivalent Activity lifecycle callback.

Best Regards,


Hi Alex,

Thanks.  Obviously my snippets are not too good.

But Yes, that is added.  And we can see the wikitude logo on the dark screen but unable to see the camera feed.

Attached is the for your perusal.





Hi YT,

the code you attached( is also missing the call to ArchitectView.onResume. 

You have to call onCreate/onPostCreate/onResume/onPause/onDestroy in the equivalent Activity lifecycle callback.

Best Regards,


Hi Alex, 

Thanks! Works great and thanks for the activity life cycle tip!

A few of my customers use AR as a sales tool and sometimes do not have access to wifi at the customers factory.  As such need to offer the option of storing the content in the cache after they have downloaded and viewed the content in a wifi environment.

Do you you have any tips as to how to realise this?

Also, should I be starting a new topic for item?

Thanks again!


Hi YT,

do you want to store the AR experience? 

You could maybe download the AR experience (the html + js + assets) store it and then use architectView.load with an absolute path to the file.

Best Regards,


hi YT,

I also face the problem with you. I can't access the camera permission. When I code the ArchitectView.onResume, my apps cannot be run. I don't know how to solve. Can you please help me?

Login or Signup to post a comment