Start a new topic

Camera only show TRIALS word and no camera view

Camera only show TRIALS word and no camera view

3 people have this problem

Hello Thomas,

Could you please send over a minimum code that would enable us to reproduce your issue? Can you also report the SDK version you are testing with and your device?

Thanks
Eva

 

Hello again,

I tested the sample app and everything is working fine. 

I don't understand why I still can't use my camera on my personnal application?

Here is the tutorial I followed: https://www.youtube.com/watch?v=JgcB6tMi0qE

Tell me if you need my files to check the code, but everything seems fine and I have no errors logged .

Thanks again,


Julien

Hi Julien,


It would be very helpful if you could provide a project with the minimal code required for this issue to happen. 

This way it will be a lot easier to find the issue.


Best Regards,

Alex

 This is my architectView activity:

package com.example.thomas.artest;

import android.Manifest;
import android.app.Activity;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.wikitude.architect.ArchitectStartupConfiguration;
import com.wikitude.architect.ArchitectView;
import com.wikitude.common.camera.CameraSettings;
import com.wikitude.common.permission.PermissionManager;

import java.io.IOException;
import java.security.Permission;

public class ARtivity extends Activity {

    protected ArchitectView architectView;

    public static final String KEY = "xzyLUb8xLJhjCcnvsMW3Sx2mfYJqxewOB3xJ+X4cWd14ZmvOou61Ih95TERKNwHfqVTJ4zWRg+zMGWjQJg1QYeMb7MvcBijzxqhd/OZl18hGjN8bOrOiUbxi64CMYrdpM1soimzMLhV+GqzdRt+wZWenatwTKfYoDJ9d+sxsO+NTYWx0ZWRfX9d4qgY+oB6bOZK0Z0DX1AFp1kZWhQeSBTZjrSHbomM7lmi4gaWjDlAaA/7GQLU2pCQQqKTiEEvV0SFosUYLPxTcad6Ot9SEgLGHJrjerAjvAfQvP0LkvQVguBXKZl4opzTyf8LeTmrZDt1R3WtffqsCjaEkwVH06pw4O+y5JwCXclLz2FH2eDddt7tKqAp/TxAOkA398+OhfR8yNkutXn2Yr0D/vMabt27OZTrRFfhWPbi3JeobXqg5ih+CvZf/hxLcYeKJ7i4K9nRYFUwopAbKX/Gm+mvtmPEyOOp8v/SVlErCIWhVwLoXujvUcmi96gGuDQS8GY1zf8pMYY8LmIruldBc4jR7qiIpQWBHE77uSstaYOzUmsr7II+oGQCdjiRAUtsjqhInFal/jtfwgG+OFdIVPlrfH/LEpH/WvJMN5q3JXtUw0C7N64ql3wozP3bTy96XmYuiEH/PXFETSzEdi7VnIiV9/LfOm2e/KzJree9RIG6KLEw=";

    PermissionManager pm;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_artivity);

        architectView = (ArchitectView)findViewById(R.id.architectView);

        final ArchitectStartupConfiguration config = new ArchitectStartupConfiguration();
        config.setLicenseKey(KEY);
        config.setCameraPosition(CameraSettings.CameraPosition.DEFAULT);
        architectView.onCreate(config);

    }

    @Override
    public void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        if (this.architectView != null) {
            this.architectView.onPostCreate();
            try {
                this.architectView.load("test/index.html");

            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }
}

 MainActivity where you press a button to access the ARtivity: 

package com.example.thomas.artest;

import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.wikitude.architect.ArchitectView;
import com.wikitude.common.permission.PermissionManager;

import java.util.Arrays;

public class MainActivity extends AppCompatActivity {

    PermissionManager pm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        pm = ArchitectView.getPermissionManager();


        Button btn = (Button)findViewById(R.id.button);
        final String[] permissions = new String[]{Manifest.permission.CAMERA};
        btn.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                pm.checkPermissions(MainActivity.this, permissions, PermissionManager.WIKITUDE_PERMISSION_REQUEST, new PermissionManager.PermissionManagerCallback() {
                    @Override
                    public void permissionsGranted(int i) {
                        Intent intent = new Intent(MainActivity.this, ARtivity.class);
                        startActivity(intent);
                    }

                    @Override
                    public void permissionsDenied(@NonNull String[] strings) {
                        Toast.makeText(MainActivity.this, "The Wikitude SDK needs the following permissions to enable an AR experience: " + Arrays.toString(strings), Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void showPermissionRationale(final int i, @NonNull String[] strings) {
                        AlertDialog.Builder alertBuilder = new AlertDialog.Builder(MainActivity.this);
                        alertBuilder.setCancelable(true);
                        alertBuilder.setTitle("Wikitude Permissions");
                        alertBuilder.setMessage("The Wikitude SDK needs the following permissions to enable an AR experience: " + Arrays.toString(strings));
                        alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                pm.positiveRationaleResult(i, permissions);
                            }
                        });

                        AlertDialog alert = alertBuilder.create();
                        alert.show();
                    }
                });


            }
        });
    }


    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        pm.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}

  and this is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.thomas.artest">

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />
    <uses-feature
        android:name="android.hardware.location"
        android:required="true" />
    <uses-feature
        android:name="android.hardware.sensor.accelerometer"
        android:required="true" />
    <uses-feature
        android:name="android.hardware.sensor.compass"
        android:required="true" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ARtivity" android:configChanges="screenSize|orientation"></activity>
    </application>

</manifest>

 I'm using Wikitude SDK version 7.0.0 and this is my build.gradle file for the app: 

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.thomas.artest"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(name: 'wikitudesdk', ext: 'aar')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

 to test i have tried using Xiaomi Redmi Note 4 running Android 7.0 and a Samsung s6 running android 7  and the same problem has persisted with all of them. Thanks for the incredibly fast reply!! 


Tom 

Hi Tom,


if this is the whole code for your ARtivity you are missing other ArchitectView lifecycle calls.

You will have to call ArchitectView.onResume/onPause/onDestroy in their respective Activity Lifecycle methods.


Best Regards,

Alex

Login or Signup to post a comment