How call a Android native class with implements from unity ?

Hi All,

we are creating an application in unity using Android’s Eclipse project.

In Eclipse project , we have a class like

package com.unity3d.player;
public class TestProjectActivity extends unityPlayerActivity{

from Unity we are calling the above native class using below code. working perfect

AndroidJavaClass testClass = new AndroidJavaClass("com.unity3d.player.TestProjectActivity");

But, if i have a class like below

public class TestProjectActivity extends UnityPlayerActivity implements ConnectionCallbacks, OnConnectionFailedListener, OnClickListener{

from unity if i call like

AndroidJavaClass testClass = new AndroidJavaClass("com.unity3d.player.TestProjectActivity");

am getting an error,

caused by: java.lang.classnotfoundException: com.unity3d.player.TestProjectActivity

What was the problem ? how to call

public class TestProjectActivity extends UnityPlayerActivity implements ConnectionCallbacks, OnConnectionFailedListener, OnClickListener{ 

?

can anyone suggest ?

Try putting a copy of the google-play-services.jar file into your Plugins/Android folder alongside your own code jar file. I haven’t used it myself but from the documentation it sounds like this is what they expect you to do.

@GFOOT , Thanks for the reply. placed google-play-services.jar in Plugins/Android folder along with my code jar file.

the ClassFoundException error was gone.

Now i have to Call a method which is in my Eclipse project

public void sharePhoto(final String textPath, final String imagePath)
	{

    }

From unity, am calling like

if(GUI.Button (new Rect(150,150,100,50),"Click")){
			AndroidJavaClass testClass = new AndroidJavaClass("com.unity3d.player.TestProjectActivity");
			testClass.Call<AndroidJavaObject>("sharePhoto","hai Sir","http://stereo.gsfc.nasa.gov/beacon/latest_256/ahead_euvi_195_latest.jpg");		
		}

am getting an error like [21262-screen+shot+2014-01-28+at+11.37.41+am.png|21262]

can you help on this ? Thank you in Advance.

You should post a separate question really, but the answer is that your Java method doesn’t return a value so when you call it you should not specify the generic argument. Just call it like this:

testClass.Call("sharePhoto","hai Sir","http://stereo.gsfc.nasa.gov/beacon/latest_256/ahead_euvi_195_latest.jpg");