Skip to content

Instantly share code, notes, and snippets.

@TheBrousse
Created August 10, 2014 20:23
Show Gist options
  • Save TheBrousse/27422c2771f987a3f34e to your computer and use it in GitHub Desktop.
Save TheBrousse/27422c2771f987a3f34e to your computer and use it in GitHub Desktop.
Android URL scheme
if (OS_ANDROID) {
var activity = Ti.Android.currentActivity;
var data = activity.getIntent().getData();
if (data) {
// You can parse your params here
var params = urlToObject(data);
Ti.API.info('Do you own thing...');
}
}
var urlToObject = function(url) {
var result = {};
url = url.replace('iesmobile://?', '');
var params = url.split('&');
params.forEach(function(param) {
var keyValue = param.split('=');
result[keyValue[0]] = decodeURI(keyValue[1]);
});
return result;
};
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest package="com.macdaddy.notesfromschool" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<application android:debuggable="false"
android:icon="@drawable/appicon"
android:label="ies-mobile"
android:name="IesMobileApplication"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<activity android:name=".IesMobileActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
android:alwaysRetainTaskState="true"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait"
android:launchMode="singleTop">
<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.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="" android:scheme="iesmobile"/>
</intent-filter>
</activity>
</application>
</manifest>
</android>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment