Hi,
- Sort Posts
- 5 replies
- Last post
incompatibility with other plugin
incompatibility with other plugin
Hi,
We have a project developing with vuforia and need to share images on Social media networks.
For this we are using prime31's plugin. but these two have its own MAIN Activities. We are unable to merge the Andoid manifest files.
can you help how to merge these Manifests ? it would help to so many developers.
AND
Can you give more explanation for how to use the given code snippets (previous comments), I tried to use the code on a button event. but am getting there is no "currentActivity" error.
AndroidJavaClass ajc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity");
Can you please give more explanation ? it would be great and helpful for many developers.
Thank you.
incompatibility with other plugin
Hello,
Can I please get more details on this? I'm trying to handing mergeing of multiple android plugins for Unity. I understand its something to do with multiple plugins using the manifest command <action android:name="android.intent.action.MAIN" />
How do you use the first two blocks of code? Is there other setup involved? Does this cleanly allow multiple 'main' plugins?
Thanks.
incompatibility with other plugin
Copying the previous post into a new thread with proper formatting for readability (moderators feel free to format the OP and delete mine if needed)
//In case RootActivity is the MAIN in the manifest AndroidJavaClass ajc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity"); ajo.Call("launchScannerImpl", showUI, defaultTxt, symbol, forceLandscape); //In case RootActivity is not the MAIN activity in the manifest (multi-plugin) AndroidJavaClass ajc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity"); var jc = new AndroidJavaClass("com.c4mprod.ezcodescanner.RootActivity"); jc.CallStatic("launchScannerImpl", ajo, showUI, defaultTxt, symbol, forceLandscape);
//On the plugin side we extend the RootActivity from UnityPlayerActivity and //the CallStatic calls this: public static void launchScannerImpl(Activity root, boolean showUI, String defaultText, int symbols, boolean forceLandscape) { Intent intent = new Intent(root, CameraActivity.class); intent.putExtra(RootActivity.EXTRA_BOOLEAN_UI, showUI); intent.putExtra(RootActivity.EXTRA_STRING_TXT, defaultText); intent.putExtra(RootActivity.EXTRA_INT_SYMBOLS, symbols); intent.putExtra(RootActivity.EXTRA_BOOLEAN_LANDSCAPE, forceLandscape); root.startActivity(intent); }
incompatibility with other plugin
We made also ourselves some Unity Plugins (i.e EasyCodeScanner,
EasyAnalytics) and to avoid the conflicts between our plugin and other
unity plugins we've put in place a small trick that prevent us from being
the main activity.
On the Unity side instead of doing this (which forces the plugin as being
the main activity):
//In case RootActivity is the MAIN in the manifest
AndroidJavaClass ajc = new
AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity");
ajo.Call("launchScannerImpl", showUI, defaultTxt, symbol, forceLandscape);
We do this:
//In case RootActivity is not the MAIN activity in the manifest
(multi-plugin)
AndroidJavaClass ajc = new
AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity");
var jc = new AndroidJavaClass("com.c4mprod.ezcodescanner.RootActivity");
jc.CallStatic("launchScannerImpl", ajo, showUI, defaultTxt, symbol,
forceLandscape);
On the plugin side we extend the RootActivity from UnityPlayerActivity and
the CallStatic calls this:
public static void launchScannerImpl(Activity root, boolean showUI, String
defaultText, int symbols, boolean forceLandscape) {
Intent intent = new Intent(root, CameraActivity.class);
intent.putExtra(RootActivity.EXTRA_BOOLEAN_UI, showUI);
intent.putExtra(RootActivity.EXTRA_STRING_TXT, defaultText);
intent.putExtra(RootActivity.EXTRA_INT_SYMBOLS, symbols);
intent.putExtra(RootActivity.EXTRA_BOOLEAN_LANDSCAPE,
forceLandscape);
root.startActivity(intent);
}
That way we get the main activity already in place, instead of forcing
ours, and launch our own activity from that. We don't know if it can be
applied to your plugins but just in case it might help.
Best,
See reply to your question here:
https://developer.vuforia.com/forum/general-discussion/androidmanifest-file-issue-socialnetworking-plugin