- Home /
How to talk to Java plugin
I have this AdMob plugin, and I want to toggle the ads on and off.
The ads work and everything. I just want to call this function
public class AdMobTestActivity extends UnityPlayerActivity
{
private AdView adView;
///
private void TurnInvisible(){
adView.setVisibility(AdView.INVISIBLE);
Log.i("ADS","Ads turned off");
}
}
What do I do in Javascript to call this method from the Java file?
UPDATE: So I added this:
var jo:AndroidJavaClass= new AndroidJavaClass("co.org.example.AdMobTest.AdMobTestActivity");
jo.Call("TurnInvisible");
Into my Javascript file, but it says "Unable to find Method id for TurnInvisible"
How can I call this Java method?
I have a total of four questions up, but zero answers for any of them. I have a feeling that this community could use some improvements.
The reality is that this is a Unity answers site; we don't support Ad$$anonymous$$ob. However, this is really about receiving method calls from a native plugin. Have you tried searching google? Sadly, the most experienced devs don't have much time to check out the site, and it's really just for beginners anyway. Try looking at this post, and also check out what Ad$$anonymous$$ob says to do. We just integrated it into a game we're doing, but I didn't handle the integration so I don't know the specifics.
http://forum.unity3d.com/threads/18059-Import-external-DLL-in-unity
Yeah, well, again, that's not really a Unity specific question; it's a DLL Import question, which is code specific stuff. I'd suggest Stack Overflow.