uditha
February 28, 2019, 9:22am
1
I need to open my game and join the client to a game room when the client receives a link via WhatsApp.I used colyseus as a game server.
i hope to send a get request in this format (https://"…serverUR L…":port/api/privateGameRoom?id="…globalroomID ) and use the server to redirect “appname//private_room?id=${data.id}”
Are there any other way to do this process and please kindly advice how I get the parameter values to the game script when app open after calling “appname//private_room?id=${data.id}”
please help me
AGulev
February 28, 2019, 11:03am
2
First of all, you need to register URL scheme in operation system.
On Android, you need to change your AndroidManifest.xml according to this instruction: https://developer.android.com/training/app-links/deep-linking
How to do it on iOS you can read here: https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app
For receiving URL link information use our Inter-app communication module:
2 Likes
uditha
February 28, 2019, 11:19am
3
this is my appmanifect file and when i add data android:scheme=“mygame” host=“multiplayer”
line app install successfull but it cannot open.please help
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="{{android.package}}"
android:versionCode="{{android.version_code}}"
android:versionName="{{project.version}}"
android:installLocation="auto">
<uses-feature android:required="true" android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="26" />
<application
{{#has-icons?}}
android:icon="@drawable/icon"
{{/has-icons?}}
android:label="{{project.title}}" android:hasCode="true"
android:name="android.support.multidex.MultiDexApplication">
<!-- For Local Notifications -->
<receiver android:name="com.defold.push.LocalNotificationReceiver" >
</receiver>
<!-- For GCM (push) -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- For Facebook -->
<meta-data android:name="com.facebook.sdk.ApplicationName"
android:value="{{project.title}}" />
<activity android:name="com.dynamo.android.DefoldActivity"
android:label="{{project.title}}"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="{{orientation-support}}"
android:launchMode="singleTask">
<meta-data android:name="android.app.lib_name"
android:value="{{exe-name}}" />
{{#android.push_field_title}}
<meta-data
android:name="com.defold.push.field_title"
android:value="{{android.push_field_title}}" />
{{/android.push_field_title}}
{{#android.push_field_text}}
<meta-data
android:name="com.defold.push.field_text"
android:value="{{android.push_field_text}}" />
{{/android.push_field_text}}
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mygame" host="multiplayer" />
</intent-filter>
</activity>
<activity android:name="com.dynamo.android.DispatcherActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.facebook.FacebookActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="{{project.title}}" />
<activity android:name="com.defold.iap.IapGooglePlayActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="IAP">
</activity>
<!-- For Local Notifications -->
<activity android:name="com.defold.push.LocalPushDispatchActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<!-- For GCM (push) -->
<activity android:name="com.defold.push.PushDispatchActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<receiver
android:name="com.defold.push.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</receiver>
<!-- For IAC Invocations -->
<activity android:name="com.defold.iac.IACActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{{android.package}}" />
</intent-filter>
</activity>
<!-- For Amazon IAP -->
<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
<intent-filter>
<action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- For GCM (push) -->
<!-- NOTE: Package name from actual app here! -->
<permission android:name="{{android.package}}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- NOTE: Package name from actual app here! -->
<uses-permission android:name="{{android.package}}.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
<!-- END_INCLUDE(manifest) -->
AGulev
February 28, 2019, 12:47pm
4
Now you have added it as part of facebook activity, but it should be a part of iac activity:
<!-- For IAC Invocations -->
<activity android:name="com.defold.iac.IACActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{{android.package}}" />
<data android:scheme="mygame" host="multiplayer" />
</intent-filter>
</activity>
After tests would be better to replace multiplayer and my game with something more unique.
uditha
March 12, 2019, 8:50am
5
Thanks for your reply.
i also notice that it can have one " <data android:scheme=“mygame” host=“multiplayer” />" tag and in my code there are two. after removing one tag its worked
3 Likes
I’m also trying this using defold/extension-iac: Inter-app communication extension for Defold (github.com)
My current issue is when I add this stuff to AndroidManifest.xml
, it seems not working
<!-- For IAC Invocations -->
<activity android:name="com.defold.iac.IACActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{{android.package}}" />
<data android:scheme="kyhoang2" />
</intent-filter>
</activity>
but if I add to com.dynamo.android.DefoldActivity
like this:
<activity android:name="com.dynamo.android.DefoldActivity"
android:label="{{project.title}}"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="{{orientation-support}}"
android:exported="true"
android:launchMode="singleTask">
<meta-data android:name="android.app.lib_name"
android:value="{{exe-name}}" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{{android.package}}" />
<data android:scheme="kyhoang2" />
</intent-filter>
</activity>
it seems work, clicking on “kyhoang2://app/test” can open my app but the iac listener not working. What should I do?
I finally figured out why the iac extension not working. Having android:exported="false"
is the cause. I had to fork and change it to “true” make it work for me