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

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

 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 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

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

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

 

I have the same problem as Julien, I have checked to see if the SDK Examples work and the camera works fine for them. Can't seem to pinpoint the problem. I have also used the PermissionManager to check for camera permissions and that hasn't helped. What would be the next step? 


Thanks, 


Tom

Hello again!

Thanks for answering that fast. I allowed camera permissions as the following screenshot can show you, but I didn't try with the sample apps. Gonna try it today.


image

Thx again,


Julien


Hell Julien,

You cannot use the emulator for SDK versions prior to 7.0 since this is something that we have integrated with our SDK 7.1 version. Did you try with our sample app and still receiving the same error? Did you make sure that you have allowed camera permissions for our SDK?

Thanks
Eva

 

Hello there,

I feel sorry to re-open that ticket, but I encounter the same problem as the first one Soo How NG got. On my first trial app, i only get a black background and the trial word on the screen. It seems that the SDK is fully loaded, but i can't use my camera vision, any idea?

I run on Android Marshmallow (23) and id doesn't work, neither on android Kitkat (19). I tried it on the emulator and on my phone device, and I use the last version of the javascript sdk, the 7.0.0.

Thanks by advance,


Julien


1 person likes this

Hi.

Since the Epson BT-200 screen is transparent, you only see the augmentation and the camera frames are not rendered.

Hello guys!

I'm trying to run example apps on my EPSON BT-200 and have the same issue as described above - despite of camera view i can only see black screen. I have the last updated version, and non empty trial license key as an argument in the architect as described in the "setup project..." part. Did I miss something?

Kind regards

Marta

 

Man, I have the same exact frustration. The wikitude team must really have 1 more line of instruction in their "Getting started" page to say that you need to update the trial SDK key cause as the WikitudePlugin.js says to leave it empty. Please just update the comment there. It will resolve alot of unnecessary headache!

I tested the screenshot function on some devices, and couldn't reproduce your problem with the sample application.

On Android: if you are implementing the snapshot function in your own application, make sure that your application has the permission WRITE_EXTERNAL_STORAGE: the screenshot will be saved to file, and your application will receive an event "onScreenCaptured" with the file name as a parameter. The plugin sample application defines this function in the "index.js" file.

You can also define another callback function "onScreenCapturedError": you will get more information in case something goes wrong.

 

There is still a problem with screen capture, it doesnt work on Phonegap app (iOS and Android).
It works though on Native app (iOS and Android)

But I need a working screen capture version on phonegap. Please assist. thanks!

Hi, I did try to go through the setup for phonegap app project and add plugin following the guide as per from http://www.wikitude.com/external/doc/documentation/latest/phonegap/setupguidephonegap.html

And I still the same issue as before and also it said unlicensed SDK. As for configuration, I dont think there is any configuration at all! Because all I did, was just putting the code together.

Please assist. thanks!

 

My bad, now the images show up correctly. And that's after I inserted a trial version sdk key. The confusion was at the WikitudePlugin.js where it said,
 

/**

*  This is the SDK Key, provided to you after you purchased the Wikitude SDK from http =//www.wikitude.com/store/.

*  If you're having a trial version, leave this string empty.

*/

 

So, I intuitively, left it empty.
But after I cross checked with the setup guide in the link from my last post. I realized, may be the developer didn't get memo on this.

 

Cheers.

I will work on it and will let you guys know if I go into any trouble again. Thanks a lot.
Login or Signup to post a comment