Hi,
I want to make my android game open with a custom link like this:
http://www.example.com/open?custom_param1=val1
and retrieve the information of the custom_param1 and use it on my game. I tried to search info and I got the following setup:
on my game.Build.cs I added this:
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", System.IO.Path.Combine(PluginPath, "custom_APL.xml")));
then, the custom_APL.xml is the following:
<?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="test"/>
</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 App Tiles to manifest file. -->
<addElements tag="$">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.example.com" />
</intent-filter>
</addElements>
</true>
</if>
</loopElements>
</androidManifestUpdates>
<gameActivityOnCreateAdditions>
<insert>
Uri data = this.getIntent().getData();
if (data != null){
if(data.isHierarchical(){
if(activity != null) {
if (data.getQueryParameter("custom_param1") != null) {
String param1 = data.getQueryParameter("custom_param1");
Log.debug("now what??.");
}
}
}
}
</insert>
</gameActivityOnCreateAdditions>
</root>
I can see that the manifest of my game is getting the intent-filter additions, and when I start the game, I can see the debug line “now what??.” but I have no clue on what to do next. I don’t know how to access the custom_param1 from c++, and also, my game isn’t launching when I click on “http://www.example.com/open?custom_param1=val1” hyperlink
Can someone give me some hint or idea to follow? I’m really confused by this.
Thank you,
David.