简体   繁体   中英

Android Unity Plugin Manifest

I am working on a Unity plugin and I need to set

<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />

in the AndroidManifest.xml in the <Activity> tag. I would prefer to set this in the plugin manifest and have it add it to the project manifest instead of having the user add it themselves. Is there any way to do this?

This is a late answer and maybe you've already figured it out. You can include this AndroidManifest.xml file in the Unity project, here is the path: YourProjectname/Assets/Plugins/AndroidManifest.xml

When you build the project for Android, you can double check the AndroidManifest.xml in YourProjectname/Temp/StagingArea/AndroidManifest.xml which is the final setting for your apk file. Hope that helps!

Here is the AndroidManifest built with unity 2018.3

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:label="@string/app_name"
        android:icon="@drawable/app_icon">

        <activity
            android:name="com.unity3d.player.UnityPlayerActivity"
     android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

            <intent-filter>

                <action
                    android:name="android.intent.action.MAIN" />

                <category
                    android:name="android.intent.category.LAUNCHER" />

                <category
                    android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="unityplayer.UnityActivity"
                android:value="true" />
        </activity>
    </application>
</manifest>

Add any meta-data tags you need in this AndroidManifest.xml file and place this at /Assets/Plugins/Android/AndroidManifest.xml

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM