- Home /
Multiple Plugins on Android
I have a project that involves both Qualcomm's AR plugin and a separate plugin to get data from the compass. But that means I have two AndroidManifest.xml 's. How do I merge the two?
Answer by Psykna · Oct 11, 2012 at 06:30 PM
Hi,
I have exactly the same problem. I have 2 android plugins, Vuforia and my plugin, but only one activity can be the "currentActivity" of Unity:
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer") ; AndroidJavaObject jo = jc.GetStatic("currentActivity") ;
-> In the manifest, if the activity declared as "android.intent.action.MAIN" is the Vuforia one then I cannot launch my activities, and vice versa, if my root activity is the MAIN, then Vuforia cannot be launched.
I wonder how 2 main activities can co-exist or how to launch two activities from different packages.
My guess is to have only one entry point in the manifest (i.e my plugin's main activity) and then make a method (in my main activity obtained by "currentActivity") to either launch my own activities or the Qualcomm main activity (via intent). It means the at lest one plugin has to be recompiled (and mine would be easier than the Qualcomm one).
Does anyone have found a other solution?
Answer by Psykna · Oct 12, 2012 at 03:07 PM
You can add your compass activities along with the Qualcomm's one:
In the manifest :
[...]
<activity
android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerActivity"
android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"
android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<!- And here declare your activities with their own packages -->
<activity android:name="com.your.package.RootActivity"
android:label="@string/app_name">
</activity>
[...]
And then if you want to launch them (since the MAIN activity is the Qualcomm's one) you have to grab the current activity and launch statically your activity from it as described here :
Hope it helps
Answer by EduardBosch · Jan 24, 2014 at 10:55 AM
I think for those who wants to use Vuforia and their plugins in the same custom activity this article is really useful. It explains how to extend Vuforia QCARPlayerNativeActivity.
https://developer.vuforia.com/forum/faq/unity-how-can-i-extend-unitys-android-activity
Hope this is useful to somebody