- Home /
Any resource for creating jar without extending UnityActivityPlayer?
Hello guys,
I am trying to communicate Unity with Android using "jar" and then a callback to Unity from "jar". However, I really don't want to extend UnityActivityPlayer.
I searched in the internet for a step by step tutorial as I am limited Android experience.
Please point me in that direction, if you have info.
Thanks, Karsnen.
Answer by Voxel-Busters · Oct 27, 2015 at 05:18 PM
You don't need to extend unity's activity always to communicate with native android (conditions apply).
Create a class instance of your native class and call its methods. For passing back to unity, you can use UnitySendMessage from unity's classes.jar lib and create your library.
Place your library jar file in Plugins/Android folder.
AndroidJavaObject Plugin = new AndroidJavaObject("com.voxelbusters.features.addressbook");
bool _accessGranted = Plugin.Call(Native.Methods.IS_AUTHORIZED);
Above code snippet is from Cross Platform Native Plugins Lite version.