Skip to content

Instantly share code, notes, and snippets.

@vindriaoc
Forked from dawsontoth/app.js
Created April 23, 2011 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vindriaoc/938493 to your computer and use it in GitHub Desktop.
Save vindriaoc/938493 to your computer and use it in GitHub Desktop.
Launch Custom Android Application from Android Browser with Titanium Mobile
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(Ti.UI.createLabel({ text: 'Type appcelerator.com in a browser, and this app will get launched. Try it!' }));
win.open();
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
win.add(Ti.UI.createButton({title: 'Our app was launched when you typed appcelerator.com!'}));
});
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
...
<android xmlns:android="http://schemas.android.com/apk/res/android">
<activities>
<activity url="launchFromURL.js">
<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="http" android:host="www.appcelerator.com"/>
</intent-filter>
</activity>
</activities>
</android>
...
</ti:app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment