This extension provides functionality for launching other apps via a URL, and detecting when this app is launched by a URL with a custom scheme. This can be useful for integrating with 3rd party apps or integrating to & from a website.
- This extension implicitly includes
extensionkitwhich must be available in a folder beside this one. - This extension adds additional values to
Info.pliston ios andAndroid.manifeston android.
git clone https://github.com/bazzisoft-openfl-extensions/extensionkit
git clone https://github.com/bazzisoft-openfl-extensions/interop
lime rebuild extensionkit [linux|windows|mac|android|ios]
lime rebuild interop [linux|windows|mac|android|ios]
<include path="/path/to/extensionkit" />
<include path="/path/to/interop" />
<!--
This specifies that our app can be launched with URLs like:
my-custom-url-scheme://any-host/any/path
-->
<setenv name="LAUNCH_FROM_URL_SCHEME" value="my-custom-url-scheme" />
class Main extends Sprite
{
public function new()
{
super();
// Add the event listener BEFORE calling Initialize(), otherwise you will not receive
// the event if the app was created via a URL rather than just resumed.
stage.addEventListener(LaunchedFromURLEvent.LAUNCHED_FROM_URL, function(e) { trace(e); } );
Interop.Initialize();
...
}
}
If not overriding the default AndroidManifest.xml template in your project.xml,
the interop extension will override it and add the required intent filters based
on the LAUNCH_FROM_URL_SCHEME env setting.
If you override with your own AndroidManifest.xml, make sure to include the
following additional <intent-filter> node under <application>:
<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="my-custom-url-scheme"/>
</intent-filter>
If not overriding the default Info.plist template in your project.xml,
the interop extension will override it and add the required custom URL scheme based
on the LAUNCH_FROM_URL_SCHEME env setting.
If you override with your own Info.plist, make sure to include the
following additional nodes under the top level <dict>:
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>::APP_PACKAGE::</string>
<key>CFBundleURLSchemes</key>
<array>
<string>my-custom-url-scheme</string>
</array>
</dict>
</array>