|In order to take part in the Unity Activity sharing system, there are a few steps you will need to take outlined below. First, some background. You can signify which class you would like to receive all the Activity lifecycle methods. When you implement the methods they should have the exact same signature but they should be *public static void*. That is important! They will not be called if they are not public static void. You can implement 1 or all of the methods. That is entirely up to your needs.|
|1. Download the Prime31UnityActivity.jar file from here: https://app.box.com/s/xw6hq1ltjaniycc14j21 You are free to distribute the file but *do not change it's name*! That would defeat the purpose of the sharing mechanism!|
|2. Implement any of the methods that are available in this Gist (https://gist.github.com/prime31/10747997)|
|3. Perform the AndroidManifest changes below|
|If successful, on app launch you will see a log that looks like the following:|
|found Activity proxy class: com.yourpackage.yourclass|
|Note for plugin vendors: one really simple way to have your plugin "just work" when the Activity sharing system is being used is to perform steps 1 and 2 above and only add the meta-data line to the AndroidManifest. By doing that your plugin will work as it does currently and when the Activity sharing system is being used by the end user.|
|- add the following line to the AndroidManifest replacing the "com.yourpackage.yourclass" with the full qualified name of the class that you would like to be notified of Activity lifecycle methods.|
|<meta-data android:name="com.yourpackage.yourclass" android:value="UnityPlayerActivityProxy"/>|
|- add the following Activity:|
|<action android:name="android.intent.action.MAIN" />|
|<category android:name="android.intent.category.LAUNCHER" />|
Hi, I am currently using Prime31 Android Social Networking Plugin. I am currently working on a plugin to open the photo gallery and get the Image URI from the result. I have posted a question on SO and a kind soul guided me here. http://stackoverflow.com/questions/27356675/unity-android-gallery/27373880?noredirect=1#comment43201610_27373880
From the Instruction, the part before manifest changes is done in Eclipse and the manifest changes are in Unity. Am I correct?
To be more precise step 1-2 is creating a java class (not an activity) and implement there one or more of the listed methods (https://gist.github.com/prime31/10747997#). You can create your classes with eclipse or android studio or whatever IDE you prefer. Compile your java class into a .jar folder and place it under Assets/Plugins/Android in your Unity project folder. In the same folder you find the AndroidManifest. Place the meta-data tag for example right after the activity tag of prime31.
// I got error here. "it is indirectly referenced from required .class files"
Where can the source for Prime31UnityActivity.jar be found?
The default Unity source can be found at
In my case I'd like to customize the
UnityPlayer has a protected method
That's to work around an issue with Unity 5.1.2 where audio plays after onPause because the Unity pause event is timing out. It doesn't crash, it just takes a few seconds before the audio stops after hitting the HOME button.