Add category to intent-filter into AndroidManifest.xml

Hi, I need to add a category item into intent-filter of activity section.

I couldn’t do it through Editor. I suppose it’s impossible now, so can I suggest it for next release?

And how to workaround it for now?

Thanks

1 Like

Hello MorskoyZmey,

Could you elaborate further on what it is exactly that you are requesting and could you provide a detailed example of the functionality for the feature that is being requested?

Answering your comment:

70129-2015-12-11+01-15-52+androidmanifest.xml+-+google+chrome.png

Ability to add selected category I mean as proposed functionality

It is possible to do this in 4.10 using the android plugin system work I did. Any module has the ability to add an AdditionalProperties ReceiptProperty type of AndroidPlugin and provide the path to an APL.xml file:

			if (Target.Platform == UnrealTargetPlatform.Android)
			{
				string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, BuildConfiguration.RelativeEnginePath);
				AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", Path.Combine(PluginPath, "MyAdditions_APL.xml")));
			}

Add the above to your Build.cs and put a MyAdditions_APL.xml in the same directory. The APL.xml can make changes to the AndroidManifest.xml as part of the packaging step. Here is an example MyAdditions_APL.xml which would add your intent:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
	<!-- init section is always evaluated once per architecture -->
	<init>
		<log text="MyAdditions init"/>
	</init>

	<!-- optional updates applied to AndroidManifest.xml -->
	<androidManifestUpdates>
		<!-- update the GameActivity activity -->
		<loopElements tag="activity">
			<setStringFromAttribute result="activityName" tag="$" name="android:name"/>
			<setBoolIsEqual result="bGameActivity" arg1="$S(activityName)" arg2="com.epicgames.ue4.GameActivity"/>
			<if condition="bGameActivity">
				<true>
					<!-- add my category to intent-filter -->
					<setElement result="intentInfo" value="category"/>
					<addAttribute tag="$intentInfo" name="android:name" value="com.nuitrack.intent.category.VICOVR"/>
					<addElement tag="intent-filter" name="intentInfo"/>
				</true>
			</if>
		</loopElements>
	</androidManifestUpdates>
</root>

What the above does is look for the com.epicgames.ue4.GameActivity element, create a category element and add the attribute, then insert it in the element.

If you aren’t using a code project, you can just add an empty class and it should create a build.cs for your project in the Source directory you can add these to.

Hi Chris,
Is there any documentation on the APL.xml that would show all the possible additions or updates that could be made?

Thanks

The best documentation at the moment is the comment block I wrote at the top of AndroidPluginLanguage.cs. GearVR_APL.xml also shows some of the ways the manifest may be manipulated.

There are commands for making new elements, inserting them, walking them and adding/removing attributes, etc.

Hi, thank you, this system is very useful!
Could you clarify one moment: is insert template system universal?
I mean, can be the code //$${gameActivityMyOwn}$$ processed in APL.xml?

No. I have code in UEDeployAndroid.cs for each of the sections in UpdateGameActivity(). You can add your own here but it will only be for your engine build. Did I miss a section that should be exposed?

In 4.19 I now get this warning:

'UnrealBuildTool.ModuleRules.ReceiptPropertyList.Add(UnrealBuildTool.ReceiptProperty)' is obsolete: 'Constructing a ReceiptProperty object is deprecated. Call RuntimeDependencies.Add() with the path to the file to stage.'

What is the correct syntax now for adding an “AndroidPlugin” APL.xml Receipt Property using RuntimeDependencies?

I also need to add/edit what is in the intent filter section of the activity. I’m trying to package and upload to the oculus store, and have followed all of their steps for packaging but receive this error:

APK main activity intent filter set to com.google.intent.category.CARDBOARD, but must be android.intent.category.INFO. Your app must only appear in Oculus Home. It must not appear in the phone’s launcher.

Now the answers posted below are several years and versions old so if you had any advice for me I would greatly appreciate it.

Hello MorskoyZmey,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.