AIR and iOS app options (cutsom url scheme, hidden)

Each day we discover new options and features giving the developer life more exciting!

Today I’m sharing some options for iOS development. Let say you have a main application including links to several games. You don’t want to include all this games into the main application because there are more like independant mini-games, or you don’t want to clean everything as it should when you leave your game (the lazy way), or there are several developers involved in this different games and they don’t use the same technology!

Anyway, you want to create a main application able to navigate to an other one. In other terms: communicate with other apps (Apple references check Communicating with Other Apps part and below).

In your *-app.xml document, add your url scheme for your main app inside

<iPhone><InfoAdditions><![CDATA[
<array>
<dict>
	<key>CFBundleURLSchemes</key>
	<array>
		<string>aymeric</string>
	</array>
	<key>CFBundleURLName</key>
	<string>games</string>
</dict>
</array>

From any other games on your iOS device, you can call this main application this way:

navigateToURL(new URLRequest("aymeric:games"));

Now let say we have a pirate game. Defines its url scheme:

<array>
<dict>
	<key>CFBundleURLSchemes</key>
	<array>
		<string>pirate</string>
	</array>
</dict>
</array>

You will be able to call it from your main app:

navigateToURL(new URLRequest("pirate:"));

Why not using aymeric:pirate url scheme? Well it seems there is an issue… it didn’t work on my side.

For Android you will have to create two intent filter:

<activity android:excludeFromRecents="false">
	<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="pirate"/>
	</intent-filter>
</activity>

For more informations on custom url scheme, take a look there and there.

It’s pretty cool to be able to open an app from an other one, but I already see them on the iOS “desktop”. If you have one hundred of mini-games, it may be embarassing… So let’s hide them from the “desktop” and the “dock”!

<key>SBAppTags</key>
<array>
       <string>hidden</string>
</array>
<key>SBIsRevealable</key>
<false />

Now you won’t see them anymore! Also if you’re launching games from a main application, it sounds more logical to exit them when you go back to this application, if you go back on them they will be relaunched from start.

<key>UIApplicationExitsOnSuspend</key>
<true />

That’s it!

Update: following this article, I’ve been contacted by a company which has just launched a new very interesting product. Here is the mail copy/paste:

It is called rdrct.it (pronounced redirect.it), and enables mobile developers (across iOS, Android, Windows Phone & BB10) to easily enhance the functionality of their “Custom URL Schemes” in cases where the user who clicks the link might not already have the app installed.

It has two main (related) functions. The first, which we’re calling the “Universal URL” is where an app developer (or marketer) can create one URL that directs people to the correct app store for their device e.g. iOS users to the App Store, and Android users to Google Play – this makes it much easier to advertise your app on social media by just sending out one link instead of many. We also show you which types of device are visiting the link so that you can see if your app would be popular on a device that you don’t currently support.

The second function (and the function more relevant to your article) is the support of Custom URL Schemes (as they’re called in iOS – I’m an iOS developer too, so that’s my main interest).

If my app shares my custom URL with the world, but people who click the URL don’t have the app installed, then nothing happens. With rdrct.it, if the app is installed, then it will be opened as usual (including with the query string etc). If the app is not installed, then the user is again directed to the appropriate app store for their device. This means that with one click, users are directed to the right place, and they don’t have to go and lookup the correct app to open the URL (an extra step that a lot of potential users would not undertake).

5 thoughts on “AIR and iOS app options (cutsom url scheme, hidden)

  1. Wow, fantastic weblog layout! How lengthy have you ever been blogging for? you made blogging glance easy. The whole look of your website is excellent, let alone the content!

  2. Thanks for the update Aymeric – much appreciated.

    We look forward to hearing what you and your readers think about rdrct.it.

    Keep up the great work!

Leave a Reply

Your email address will not be published. Required fields are marked *