Giter Site home page Giter Site logo

ti.deeply's Introduction

Deeply

Simple deep link handling in your Titanium Android app

Install

Automatically:

// COMING SOON

Manually:

  • Get the module from the releases page;
  • Add the content to the modules folder of your project;
  • Add <module platform="android">ti.deeply</module> under the <modules> tag of your tiapp.xml file.

Note: version 1.0.0 is for Titanium SDK >= 7.1.0, version 0.9.0 is for Titanium SDK >= 6.3.0

Usage

Add the following activity to your tiapp.xml file, in the Android manifest part:

<activity android:name="ti.deeply.DeepLinkHandlerActivity" android:noHistory="true" android:excludeFromRecents="true" android:theme="@android:style/Theme.NoDisplay" android:launchMode="singleTask">
	<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="<Your URL scheme>"/>
	</intent-filter>
	<!-- and all the other intent filters you want to declare -->
</activity>

Require the module wherever you see fit (generally, in the alloy.js or index.js of your app) and set the callback function:

var Deeply = require('ti.deeply');

Deeply.setCallback(function(e) {
	Ti.API.debug('Deep link called with:');
	Ti.API.debug('  data:', e.data);
	Ti.API.debug('  action:', e.action);
	Ti.API.debug('  extras', e.extras);
});

Test it from a terminal:

adb shell am start -a android.intent.action.VIEW -d "examplescheme://foo" your.app.id

Notes

android:launchMode

The tag android:launchMode="singleTask" is necessary for the module to work correctly when the app is opened from a closed state by a deep link. If you want more informations on why this is the case, see:

Until Titanium 7.3.0, the tag android:launchMode was automatically removed at build time. This means that, if you're using a Titanium version lower than 7.3.0, your app will not open the same deep link again if it was used to start the app.

License

MIT

ti.deeply's People

Contributors

hansemannn avatar jei avatar miniman42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.