Start a new topic

Test App crashes

Test App crashes


Hi, I have been trying to run a very simple project to run the first example on my own project. I have taken the steps mentioned in setup guid, and here is my MainActivity.java:

 

package com.example.wikitudetest;

 

import java.io.IOException;

 

import com.wikitude.architect.ArchitectView;

import com.wikitude.architect.ArchitectView.ArchitectConfig;

import com.wikitude.architect.SensorAccuracyChangeListener;

 

import android.location.Location;

import android.location.LocationListener;

import android.media.AudioManager;

import android.os.Bundle;

import android.provider.SyncStateContract.Constants;

import android.app.Activity;

import android.util.Log;

import android.view.Menu;

 

public class MainActivity extends Activity {

 

protected ArchitectView architectView;

protected SensorAccuracyChangeListener sensorAccuracyListener;

protected Location lastKnownLocaton;

protected LocationListener locationListener;

 

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

Log.d("wikitest", "Created");

/* pressing volume up/down should cause music volume changes */

this.setVolumeControlStream( AudioManager.STREAM_MUSIC );

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

// final ArchitectConfig config = new ArchitectConfig( "" /* license key */ );

// this.architectView.onCreate( config );

Log.d("wikitest", "Finished Creating");

 

setContentView(R.layout.main);

}

 

@Override

protected void onResume() {

// TODO Auto-generated method stub

super.onResume();

if ( this.architectView != null ) {

this.architectView.onResume();

}

}

 

@Override

protected void onPause() {

// TODO Auto-generated method stub

super.onPause();

if ( this.architectView != null ) {

this.architectView.onPause();

}

}

 

@Override

protected void onStop() {

// TODO Auto-generated method stub

super.onStop();

}

 

@Override

protected void onDestroy() {

// TODO Auto-generated method stub

super.onDestroy();

if(this.architectView != null){

this.architectView.onDestroy();

}

}

 

@Override

public void onLowMemory() {

// TODO Auto-generated method stub

super.onLowMemory();

if(this.architectView != null){

this.architectView.onLowMemory();

}

}

 

@Override

protected void onPostCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onPostCreate(savedInstanceState);

if ( this.architectView != null ) {

this.architectView.onPostCreate();

}

try {

this.architectView.load( "index.html" );

} catch (IOException e1) {

e1.printStackTrace();

}

Log.d("wikitest", "Post Created");

}

 

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

}

 

}

///////////////////////////////

I have copied an example to assets folder and the HTML file is called index.html

 

I just want the camera functionality so I eliminated the Gsensor and Location stuff.

any advice?

Hi Nima,

Manifest permissions, feature requirements, activity lifecycle and proper JavaScript coding are the things to keep in mind in project set-up.
Please have a look at the provided Sample-Application project which is bundled together with the SDK, here you find best-practice implementation of all main-topics.

Regards,
Andreas

 

Thanks for replyinh Andreas,

I simply copied the java code from the sample project, did the Manifest as stated in the SetupGuide and I have no idea what the other stuff you mentioned is. I will try to get to know them. thank you very much.
Login or Signup to post a comment