Start a new topic

Camera Live screen not appearing

Camera Live screen not appearing


Dear Wikitude,

I tried making sample application which is replica of the code "1.1 Image On Target".
I see the "Scan Target #1" on top, but camera live view is not coming.

I have copied contents of :    samples/1_Image$Recognition_1_Image$On$Target in my "assets" folder.
I have used path "samples/1_Image$Recognition_1_Image$On$Target/index.html" for loading AR view (this.architectView.load)
Below is the code I used. Please tell if you find any error.

______________________________________________

public class MainActivity extends Activity {

public ArchitectView architectView;

 

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        String tag = "MyActivity";

 

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

/* pass SDK key if you have one, this one is only valid for this package identifier and must not be used somewhere else */

final ArchitectConfig config = new ArchitectConfig( this.getWikitudeSDKLicenseKey() );

 

/* first mandatory life-cycle notification */

this.architectView.onCreate( config );

 

        Log.d(tag , "Start Camera App");

        

    }

 

    @Override

    protected void onPostCreate(Bundle savedInstanceState) {

    // TODO Auto-generated method stub

    super.onPostCreate(savedInstanceState);

if ( this.architectView != null ) {

 

// call mandatory live-cycle method of architectView

this.architectView.onPostCreate();

 

try {

String test = "samples/1_Image$Recognition_1_Image$On$Target/index.html";

// load content via url in architectView, ensure '<script src="architect://architect.js"></script>' is part of this HTML file, have a look at wikitude.com's developer section for API references

this.architectView.load( test );

 

 

} catch (IOException e1) {

e1.printStackTrace();

}

}

    }

 

 

private String getWikitudeSDKLicenseKey() {

// TODO Auto-generated method stub

final String WIKITUDE_SDK_KEY = "WsD6V6YuOXKbiyaf69VFN4kTxjFR81obhLyRNMfOXdHaYIfdzDSAWaQ7qNbtP59Y7wtPnlY5N00k0FlKbVJanDljfG13XgUMWzJTbbQKok4doRciQIFy7WfDWSxwLxovbcnV+yHOKoSdJdXyLb6mbxRZzuaJUyIDJnwK/r2KKadTYWx0ZWRfX3DpNxb1VlVy7rmzJjNTYjnarVHD7i3avQZCaUvReYkINnqQg5DbrTb1Uip9+D/VLGUK/GdkWf9ODbKTHoE3B+aueiAboiruoi20Z78Dc7LVNkeUhjNlet61HoAFAIahCkrVxIht/2TZ5nAimpA1Y/YqrjDgLQ6Tvq45raTYmSrCZ3xQZmDTxUDhUSPAsY6tUBj9XvPGewqqrQzDHB+vb14Als8NtXfkrTeZSz0w+Vu1EfRAFFP5MR+qfVtuAj+xIJRCnXCMGmaPUSRtW7l0j96IfX0UN2OnhITLOJwhpi0Qi2AU31LNcDuDnMfjIaKtkV1uCgYZSIvGOnec57r30JNipt2pm2w0kUrTFZsdBLlGy7qPgnLokTNx0bTIDsMtBr6e3yPXws2gWHa5zkxUxSsozf5C7yg79H9GcTukJuQEh9Dahgb7IpKGs/VfUkVui3tKVx0zmyMDEkNV/XFPUrOy0mxnS4GWwwG/zqOXE9HzSuuL7zgUZ3I=";

 

return WIKITUDE_SDK_KEY;

}

 

@Override

    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.

        getMenuInflater().inflate(R.menu.main, menu);

        return true;

    }

    

}
______________________________________________

Hi.

I can't find any error in your code just by looking at it.

Are you getting error messages or exceptions when calling the "onCreate()" method? If the camera is not available, the method should throw a RuntimeException.

If everything else is working, another issue could be the background color of your HTML file. If the background is not transparent, then the webiew may be covering the camera preview.
Login or Signup to post a comment