Log in or register to post comments

QCAR + Unity3D + Android

April 18, 2012 - 3:29am #1

Hi,
I succesed building QCAR unity package project(ImageTargets) into eclipse.

And added script in order to perform additional function.

To use script

Quote:

using UnityEngine;
using System.Collections;

public class CameraDeviceMenu : MonoBehaviour
{
void Update ()
{

void OnGUI()
{
if(GUI.Button(new Rect(100,100,100,100) , "launch"))
{
AndroidJavaClass jc = new AndroidJavaClass("com.test.android");
AndroidJavaObject jo = jc.GetStatic("currentActivity");
jo.Call("switchActivity");
}}}}

I put JAR(switchActivity Sources) in plugins/android. and then edited AndroidManifest.xml

BUT..... When I push the Button after project Build/Run, app freezing.
I didn`t know what`s wrong with it:confused:

HELP ME!

Re: QCAR + Unity3D + Android

April 18, 2012 - 4:48am #2
Quote:

AndroidJavaClass jc = new AndroidJavaClass("com.test.android");
-->> AndroidJavaClass jc = new AndroidJavaClass("com.test.android.TestAndroidActivity");

After modification.. not freezing... but still it doesn't work

-logcat

Quote:

JNI: Unable to find method id for 'switchActivity'

what is the problem.........T.T

Quote:

TestAndroidLibActivity.java

Quote:

public class TestAndroidLibActivity extends UnityPlayerActivity
{
public static TestAndroidLibActivity currentActivity;

@Override

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);}

public void switchActivity()
{
DebugLog.LOGI("*** MyPlayerActivity switchActivity ***");
Intent intent = new Intent(TestAndroidLibActivity.this, Menu.class);
startActivity(intent);
}
}

Quote:

AndroidManifest.xml

Quote:






























Log in or register to post comments