On this post I’m going to explain how to build your own Android plugins on Unity, generate a valid manifest and how to establish a bidirectional communication between your Android plugin and Unity.
First of all we need to prepare our environment and link the correct libraries on Eclipse (that’s the IDE I’m going to use on this post).
Copy the file classes.jar from your Unity installation folder (Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar) to libs folder on your Eclipse project.
Prepare your code with UnityPlayerActivity on your Main class.
To communicate from our Android plugin to Unity we can pass data with the method UnitySendMessage of UnityPlayer.
If we compile this project we will receive the messages on log console. Feel free to modify and adapt the code to your needs.
© 2019 Android is a trademark of Google Inc. Google Play is a trademark of Google Inc. Dolby and the double-D symbol are registered trademarks of Dolby Laboratories.