DreamingWell Logo

Flex Mobile Custom URL Schemes

Posted by Travis Collins on June 27, 2011

Android and iOS support launching applications via custom URL schemes, or in other words, apps can be launched by the user clicking a link or button other than the icon on the start screen. This feature allows developers to add links on public websites, or use "launch URL" commands in applications, that will cause the mobile OS to open a specific application.

Flex Mobile, using Adobe Air's android and iOS packager, supports these custom url schemes. The configuration for this custom scheme is done in the AIR application description XML file. The following shows an example custom url, use of that URL in regular HTML that would be placed on a website, and the configuration


Example Custom URL Scheme
myapp://


Example HTML Link

<a href="myapp://">Open MyApp</a>

Example XML for Android



<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application>
<activity>
<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.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="myapp"/>
</intent-filter>
</activity>
</application>
</manifest>
]]></manifestAdditions>
</android>

Example XML for iOS



<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.dreamingwell.myapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>


 

Comments

But this way not always works on android, example on HTC sensation z710e, the webkit engine will format your custom url become http scheme before launching, in this case myapp:// will become http://www.myapp.com//, that mean you won't be able to capture custom url myapp:// clicking event.

Comment by Kairen at May 3, 2012 5:41 AM


Post a comment




Remember Me?


(you may use HTML tags for style)

Twitter Status

Travis

Last Seen in

 
Privacy Policy

Copyright DreamingWell.com 1998 - 2011