Log in or register to post comments

Starting Android application from Unity

August 17, 2012 - 7:54am #1
Here is the java code that I'm using to start another application from Unity:
package com.bik3r.eclipseintegration

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.unity3d.player.UnityPlayerActivity;

public class EclipseIntegration extends UnityPlayerActivity {

    private Intent LaunchIntent;

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.ericsson.android.indoormaps.example");

    public void Launch()

And here is the corresponding c# code:

using UnityEngine;

using System.Collections;


public class GUIScript : MonoBehaviour {


// Use this for initialization

void Start () {




// Update is called once per frame

void Update () {




void OnGUI()


if(GUI.Button(new Rect(100,100,100,100) , "launch"))


AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

       AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");





When I use the above mentioned codes to integrate the Unity application (non-AR) with Eclipse and run it, the "Launch" Button Press launches the new activity (here, another application built by me). But when I do the same thing with AR application, it doesn't show the camera view in the application. Just a background color and a button(which works correctly). But we want the camera view to run ImageTargets code. So, I tried to integrate our AR application. The application works correctly except the "Launch" button. The eclipse logcat says "Unable to find Launch() in Lcom,QCAR.QCARUnityPlayer.QCARUnityPlayerNativeActivity". So I tried to extend the java code from QCARPlayerNative activity and changed the C# code to "AndroidJavaClass jc = new AndroidJavaClass("com.QCAR.QCARUnityPlayer");". But no good. The logcat now says: "Unable to find method ID for "Launch"". Can you point me to the mistake I'm making here?
Log in or register to post comments