Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<activity android:name="DeeplinkActivity" android:label="@string/app_name" >
	<intent-filter android:label="@string/app_name">
		<action android:name="android.intent.action.VIEW" />
			<category android:name="android.intent.category.DEFAULT" />
			<category android:name="android.intent.category.BROWSABLE" />
				/*/ The following attribute must be changed to identify your respective URL scheme. */
				<data android:scheme="ctmodelhouse" android:host="canvas" />
	</intent-filter>
</activity> 

Client-side Code:

Code Block
languagejs
if (isMobile.Android())
{
	var method = 'iframe';
	var fallbackFunction = function()
	{
		if (method != 'intent')
		/* The following code links to CandyCrush app for representation purpose only.
		*  You must provide the link to your mobile app */
		window.location = "https://play.google.com/store/apps/details?id=com.king.candycrushsaga";
	};
	var addIFrame = function()
	{
		var iframe = document.createElement("iframe");
		iframe.style.border = "none";
		iframe.style.width = "1px";
		iframe.style.height = "1px";
		/* The following variable must be changed to identify your respective URL scheme of your application. */
		iframe.src = "ctmodelhouse://canvas";
		document.body.appendChild(iframe);
	};
	
	if (navigator.userAgent.match(/Firefox/))
	{
		window.location = "ctmodelhouse://canvas"; 
		/* Load app via direct deep link. For Android, the URL must have host 
		*  and scheme (i.e. "ctmodelhouse://canvas") while other platforms, 
		*  the scheme "ctmodelhouse://" is enough. */
	} 
	else
	{
		addIFrame();
	}
	setTimeout(fallbackFunction, 750);
}

...