├── .gitignore ├── .travis.yml ├── MobileDeepLinking-Android-Demo ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── MobileDeepLinkingConfig.json │ ├── java │ └── com │ │ └── mobiledeeplinking │ │ └── android │ │ └── demo │ │ ├── MDLApplication.java │ │ ├── MainActivity.java │ │ ├── SecondActivity.java │ │ └── ThirdActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_main.xml │ ├── activity_second.xml │ ├── activity_third.xml │ └── fragment_main.xml │ ├── menu │ └── main.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── MobileDeepLinking-Android-SDK ├── build.gradle ├── proguard-rules.pro └── src │ ├── instrumentTest │ └── java │ │ └── org │ │ └── mobiledeeplinking │ │ └── android │ │ ├── DeeplinkMatcherTest.java │ │ ├── HandlerExecutorTest.java │ │ └── MobileDeepLinkingTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── mobiledeeplinking │ │ └── android │ │ ├── Constants.java │ │ ├── DeeplinkMatcher.java │ │ ├── Handler.java │ │ ├── HandlerExecutor.java │ │ ├── IntentBuilder.java │ │ ├── MDLLog.java │ │ ├── MobileDeepLinking.java │ │ └── MobileDeepLinkingConfig.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ └── values │ └── strings.xml ├── README.md ├── build.gradle ├── ci └── wait_for_emulator.sh ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── releases ├── 0.1.0 │ ├── MobileDeepLinking-Android-SDK.aar │ └── MobileDeepLinking-Android-SDK.jar ├── 0.1.1 │ ├── MobileDeepLinking-Android-SDK.aar │ └── MobileDeepLinking-Android-SDK.jar └── 0.1.2 │ ├── MobileDeepLinking-Android-SDK.aar │ └── MobileDeepLinking-Android-SDK.jar └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle files 2 | .gradle/ 3 | build/ 4 | 5 | # Local configuration file (sdk path, etc) 6 | local.properties 7 | 8 | # IntelliJ project files 9 | *.iml 10 | .idea/ 11 | 12 | # Android Studio captures folder 13 | captures/ 14 | 15 | # Misc 16 | .DS_Store 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk7 3 | env: 4 | matrix: 5 | - ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a 6 | before_install: 7 | # Install base Android SDK 8 | - sudo apt-get update -qq 9 | - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi 10 | - wget http://dl.google.com/android/android-sdk_r22.3-linux.tgz 11 | - tar xzf android-sdk_r22.3-linux.tgz 12 | - export ANDROID_HOME=$PWD/android-sdk-linux 13 | - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools 14 | 15 | # Gradle 16 | - wget http://services.gradle.org/distributions/gradle-1.10-bin.zip 17 | - unzip gradle-1.10-bin.zip 18 | - export GRADLE_HOME=$PWD/gradle-1.10 19 | - export PATH=$GRADLE_HOME/bin:$PATH 20 | 21 | # install android build tools 22 | - wget https://dl-ssl.google.com/android/repository/build-tools_r19.0.1-linux.zip 23 | - unzip build-tools_r19.0.1-linux.zip -d $ANDROID_HOME 24 | - mkdir -p $ANDROID_HOME/build-tools/ 25 | - mv $ANDROID_HOME/android-4.4.2 $ANDROID_HOME/build-tools/19.0.1 26 | 27 | # Install required components. 28 | # For a full list, run `android list sdk -a --extended` 29 | # Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this). 30 | # Other relevant API's 31 | - echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null 32 | - echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null 33 | - echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null 34 | - echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null 35 | - echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null 36 | - echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null 37 | 38 | # Create and start emulator 39 | - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI 40 | - emulator -avd test -no-skin -no-audio -no-window & 41 | 42 | before_script: 43 | - chmod +x ci/wait_for_emulator.sh 44 | - ci/wait_for_emulator.sh 45 | - adb shell input keyevent 82 & 46 | 47 | script: 48 | - gradle connectedInstrumentTest --info 49 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '23.0.3' 6 | 7 | defaultConfig { 8 | minSdkVersion 8 9 | targetSdkVersion 16 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:+' 23 | compile project(':MobileDeepLinking-Android-SDK') 24 | } 25 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/assets/MobileDeepLinkingConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "logging": "true", 3 | "defaultRoute": { 4 | "class": "com.mobiledeeplinking.android.demo.MainActivity" 5 | }, 6 | "routes": { 7 | "handler": { 8 | "handlers": ["testHandler"], 9 | "class": "com.mobiledeeplinking.android.demo.SecondActivity" 10 | }, 11 | "handler/:handlerId": { 12 | "handlers": ["testHandler"], 13 | "class": "com.mobiledeeplinking.android.demo.SecondActivity", 14 | "routeParameters" : { 15 | "handlerId" : { 16 | "regex": "[0-9]" 17 | } 18 | } 19 | }, 20 | "handler/order": { 21 | "handlers": ["testHandler", "testHandler2"], 22 | "class": "com.mobiledeeplinking.android.demo.ThirdActivity" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/java/com/mobiledeeplinking/android/demo/MDLApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package com.mobiledeeplinking.android.demo; 26 | 27 | import android.app.Application; 28 | import android.os.Handler; 29 | import android.os.Message; 30 | import android.util.Log; 31 | 32 | import org.mobiledeeplinking.android.MobileDeepLinking; 33 | 34 | import java.util.Map; 35 | 36 | public class MDLApplication extends Application 37 | { 38 | @Override 39 | public void onCreate() 40 | { 41 | super.onCreate(); 42 | MobileDeepLinking.registerHandler("testHandler", new org.mobiledeeplinking.android.Handler() 43 | { 44 | @Override 45 | public Map execute(Map routeParameters) 46 | { 47 | Log.d("MDLApplication", "Inside callback!"); 48 | routeParameters.put("nameFromCB", "valueFromCB"); 49 | return routeParameters; 50 | } 51 | }); 52 | MobileDeepLinking.registerHandler("testHandler2", new org.mobiledeeplinking.android.Handler() 53 | { 54 | @Override 55 | public Map execute(Map routeParameters) 56 | { 57 | Log.d("MDLApplication", "Inside callback 2!"); 58 | Log.d("MDLApplication", "nameFromCB: " + routeParameters.get("nameFromCB")); 59 | return routeParameters; 60 | } 61 | }); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/java/com/mobiledeeplinking/android/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.mobiledeeplinking.android.demo; 2 | 3 | import android.support.v7.app.ActionBarActivity; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v4.app.Fragment; 6 | import android.os.Bundle; 7 | import android.view.LayoutInflater; 8 | import android.view.Menu; 9 | import android.view.MenuItem; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.os.Build; 13 | 14 | public class MainActivity extends ActionBarActivity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | 21 | if (savedInstanceState == null) { 22 | getSupportFragmentManager().beginTransaction() 23 | .add(R.id.container, new PlaceholderFragment()) 24 | .commit(); 25 | } 26 | } 27 | 28 | 29 | @Override 30 | public boolean onCreateOptionsMenu(Menu menu) { 31 | // Inflate the menu; this adds items to the action bar if it is present. 32 | getMenuInflater().inflate(R.menu.main, menu); 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean onOptionsItemSelected(MenuItem item) { 38 | // Handle action bar item clicks here. The action bar will 39 | // automatically handle clicks on the Home/Up button, so long 40 | // as you specify a parent activity in AndroidManifest.xml. 41 | int id = item.getItemId(); 42 | if (id == R.id.action_settings) { 43 | return true; 44 | } 45 | return super.onOptionsItemSelected(item); 46 | } 47 | 48 | /** 49 | * A placeholder fragment containing a simple view. 50 | */ 51 | public static class PlaceholderFragment extends Fragment { 52 | 53 | public PlaceholderFragment() { 54 | } 55 | 56 | @Override 57 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 58 | Bundle savedInstanceState) { 59 | View rootView = inflater.inflate(R.layout.fragment_main, container, false); 60 | return rootView; 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/java/com/mobiledeeplinking/android/demo/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.mobiledeeplinking.android.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | 7 | public class SecondActivity extends Activity 8 | { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_second); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/java/com/mobiledeeplinking/android/demo/ThirdActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package com.mobiledeeplinking.android.demo; 26 | 27 | import android.app.Activity; 28 | import android.os.Bundle; 29 | 30 | public class ThirdActivity extends Activity 31 | { 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.activity_third); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-Demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-Demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-Demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 26 | 27 | 31 | 32 | 35 | 36 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/layout/activity_third.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 26 | 27 | 31 | 32 | 35 | 36 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 7 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Module 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-Demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 8 9 | targetSdkVersion 16 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:+' 23 | } 24 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/instrumentTest/java/org/mobiledeeplinking/android/DeeplinkMatcherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.net.Uri; 28 | 29 | import junit.framework.TestCase; 30 | 31 | import org.json.JSONObject; 32 | 33 | import java.util.ArrayList; 34 | import java.util.HashMap; 35 | import java.util.List; 36 | import java.util.Map; 37 | 38 | public class DeeplinkMatcherTest extends TestCase 39 | { 40 | JSONObject routeOptions; 41 | Map results; 42 | 43 | public DeeplinkMatcherTest() 44 | { 45 | } 46 | 47 | public void setUp() throws Exception 48 | { 49 | super.setUp(); 50 | routeOptions = new JSONObject("{\"routeParameters\": {}}"); 51 | results = new HashMap(); 52 | } 53 | 54 | public void tearDown() throws Exception 55 | { 56 | //builder.scheme("mdldemo").authority("data").appendPath("turtles").appendPath("types").appendQueryParameter("type", "1").appendQueryParameter("sort", "relevance"); 57 | results = new HashMap(); 58 | } 59 | 60 | public void testMatchPathParametersWithHost() throws Exception 61 | { 62 | Uri.Builder builder = new Uri.Builder(); 63 | builder.scheme("mdldemo").authority("data"); 64 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 65 | assertEquals(newResults, results); 66 | } 67 | 68 | public void testMatchPathParametersWithHostReturnsNull() throws Exception 69 | { 70 | Uri.Builder builder = new Uri.Builder(); 71 | builder.scheme("mdldemo").authority("dataa"); 72 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 73 | assertNull(newResults); 74 | } 75 | 76 | public void testMatchPathParametersReturnsNull2() throws Exception 77 | { 78 | Uri.Builder builder = new Uri.Builder(); 79 | builder.scheme("mdldemo").authority("ata"); 80 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 81 | assertNull(newResults); 82 | } 83 | 84 | public void testMatchPathParametersReturnsNull3() throws Exception 85 | { 86 | Uri.Builder builder = new Uri.Builder(); 87 | builder.scheme("mdldemo").authority("dat"); 88 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 89 | assertNull(newResults); 90 | } 91 | 92 | public void testMatchPathParametersWithPath() throws Exception 93 | { 94 | Uri.Builder builder = new Uri.Builder(); 95 | builder.scheme("mdldemo").authority("data").path("path"); 96 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 97 | assertNull(newResults); 98 | 99 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, builder.build(), results); 100 | assertEquals(newResults, results); 101 | } 102 | 103 | public void testMatchPathParametersWithPathAndTrailingSlash() throws Exception 104 | { 105 | Uri.Builder builder = new Uri.Builder(); 106 | builder.scheme("mdldemo").authority("data").path("path/"); 107 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 108 | assertNull(newResults); 109 | 110 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, builder.build(), results); 111 | assertEquals(newResults, results); 112 | } 113 | 114 | public void testMatchPathParametersFails() throws Exception 115 | { 116 | Uri.Builder builder = new Uri.Builder(); 117 | builder.scheme("mdldemo").authority("data").path("pathe"); 118 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 119 | assertNull(newResults); 120 | 121 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, builder.build(), results); 122 | assertNull(newResults); 123 | } 124 | 125 | public void testMatchPathParametersFails2() throws Exception 126 | { 127 | Uri.Builder builder = new Uri.Builder(); 128 | builder.scheme("mdldemo").authority("data").path("pat"); 129 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 130 | assertNull(newResults); 131 | 132 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, builder.build(), results); 133 | assertNull(newResults); 134 | } 135 | 136 | public void testMatchPathParametersFails3() throws Exception 137 | { 138 | Uri.Builder builder = new Uri.Builder(); 139 | builder.scheme("mdldemo").authority("daa").path("path"); 140 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, builder.build(), results); 141 | assertNull(newResults); 142 | 143 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, builder.build(), results); 144 | assertNull(newResults); 145 | } 146 | 147 | public void testMatchPathParametersWithPathParams() throws Exception 148 | { 149 | Uri.Builder builder = new Uri.Builder(); 150 | builder.scheme("mdldemo").authority("data").path("path/5"); 151 | Uri uri = builder.build(); 152 | String pathDefinition = "data/path/:pathId"; 153 | 154 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, uri, results); 155 | assertNull(newResults); 156 | 157 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, uri, results); 158 | assertNull(newResults); 159 | 160 | newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 161 | assertNotNull(newResults.get("pathId")); 162 | } 163 | 164 | public void testMatchPathParametersWithPathParamsAndTrailingSlash() throws Exception 165 | { 166 | Uri.Builder builder = new Uri.Builder(); 167 | builder.scheme("mdldemo").authority("data").path("path/5/"); 168 | Uri uri = builder.build(); 169 | String pathDefinition = "data/path/:pathId"; 170 | 171 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, uri, results); 172 | assertNull(newResults); 173 | 174 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, uri, results); 175 | assertNull(newResults); 176 | 177 | newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 178 | assertNotNull(newResults.get("pathId")); 179 | } 180 | 181 | public void testMatchPathParametersReturnsFalseWithPathParams() throws Exception 182 | { 183 | Uri.Builder builder = new Uri.Builder(); 184 | builder.scheme("mdldemo").authority("data").path("path//"); 185 | Uri uri = builder.build(); 186 | String pathDefinition = "data/path/:pathId"; 187 | 188 | Map newResults = DeeplinkMatcher.matchPathParameters("data", routeOptions, uri, results); 189 | assertNull(newResults); 190 | 191 | newResults = DeeplinkMatcher.matchPathParameters("data/path", routeOptions, uri, results); 192 | assertEquals(newResults, results); 193 | 194 | newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 195 | assertNull(newResults); 196 | } 197 | 198 | public void testMatchPathParametersWithRegex() throws Exception 199 | { 200 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"dataId\" : { \"regex\" : \"[0-9]\" } } }"); 201 | 202 | Uri.Builder builder = new Uri.Builder(); 203 | builder.scheme("mdldemo").authority("data").path("5"); 204 | Uri uri = builder.build(); 205 | String pathDefinition = "data/:dataId"; 206 | 207 | Map newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 208 | assertEquals(newResults.get("dataId"), "5"); 209 | } 210 | 211 | public void testMatchPathParametersWithRegexReturnsFalse() throws Exception 212 | { 213 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"dataId\" : { \"regex\" : \"[0-9]\" } } }"); 214 | 215 | Uri.Builder builder = new Uri.Builder(); 216 | builder.scheme("mdldemo").authority("data").path("54"); 217 | Uri uri = builder.build(); 218 | String pathDefinition = "data/:dataId"; 219 | 220 | Map newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 221 | assertNull(newResults); 222 | } 223 | 224 | public void testMatchPathParametersWithRegexReturnsFalse2() throws Exception 225 | { 226 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"dataId\" : { \"regex\" : \"[0-9]\" } } }"); 227 | 228 | Uri.Builder builder = new Uri.Builder(); 229 | builder.scheme("mdldemo").authority("data").path("somedata"); 230 | Uri uri = builder.build(); 231 | String pathDefinition = "data/:dataId"; 232 | 233 | Map newResults = DeeplinkMatcher.matchPathParameters(pathDefinition, routeOptions, uri, results); 234 | assertNull(newResults); 235 | } 236 | 237 | public void testMatchQueryParameters() throws Exception 238 | { 239 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=value", results); 240 | assertEquals(newResults, new HashMap()); 241 | } 242 | 243 | public void testMatchQueryParametersDoesntMatchWithMultipleParameters() throws Exception 244 | { 245 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=value&name2=value2", results); 246 | assertEquals(newResults, new HashMap()); 247 | } 248 | 249 | public void testMatchQueryParametersMatch() throws Exception 250 | { 251 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name\" : {} } }"); 252 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=value&name2=value2", results); 253 | assertEquals(newResults.get("name"), "value"); 254 | } 255 | 256 | public void testMatchQueryParametersMatchWithMultipleParameters() throws Exception 257 | { 258 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name2\" : {} } }"); 259 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=value&name2=value2", results); 260 | assertEquals(newResults.get("name2"), "value2"); 261 | } 262 | 263 | public void testMatchQueryParametersMatchWithMultipleParameters2() throws Exception 264 | { 265 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name2\" : {}, \"name\" : {} } }"); 266 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=value&name2=value2", results); 267 | assertEquals(newResults.get("name"), "value"); 268 | assertEquals(newResults.get("name2"), "value2"); 269 | } 270 | 271 | public void testMatchQueryParametersMatchWithRegex() throws Exception 272 | { 273 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name\" : { \"regex\" : \"[0-9]\" } } }"); 274 | Map newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=5&name2=value2", results); 275 | assertEquals(newResults.get("name"), "5"); 276 | 277 | results = new HashMap(); 278 | newResults = DeeplinkMatcher.matchQueryParameters(routeOptions, "name=banana&name2=value2", results); 279 | assertNull(newResults); 280 | } 281 | 282 | public void testCheckForRequiredRouteParameters() throws Exception 283 | { 284 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name\" : { \"required\" : \"true\" } } }"); 285 | List expected = new ArrayList(); 286 | expected.add("name"); 287 | List result = DeeplinkMatcher.getRequiredRouteParameterValues(routeOptions); 288 | assertEquals(expected, result); 289 | } 290 | 291 | public void testCheckForRequiredRouteParameters2() throws Exception 292 | { 293 | routeOptions = new JSONObject("{ \"routeParameters\" : { \"name\" : { \"required\" : \"false\" } } }"); 294 | List expected = new ArrayList(); 295 | List result = DeeplinkMatcher.getRequiredRouteParameterValues(routeOptions); 296 | assertEquals(expected, result); 297 | } 298 | 299 | public void testCheckForRequiredRouteParameters3() throws Exception 300 | { 301 | routeOptions = new JSONObject("{ \"routeParameters\" : {} }"); 302 | List expected = new ArrayList(); 303 | List result = DeeplinkMatcher.getRequiredRouteParameterValues(routeOptions); 304 | assertEquals(expected, result); 305 | } 306 | } 307 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/instrumentTest/java/org/mobiledeeplinking/android/HandlerExecutorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import junit.framework.TestCase; 28 | 29 | import org.json.JSONObject; 30 | 31 | import java.util.HashMap; 32 | import java.util.Map; 33 | 34 | public class HandlerExecutorTest extends TestCase 35 | { 36 | private MobileDeepLinking mobileDeepLinking; 37 | private JSONObject routeOptions; 38 | 39 | public void setUp() throws Exception 40 | { 41 | super.setUp(); 42 | mobileDeepLinking = new MobileDeepLinking(); 43 | } 44 | 45 | public void testExecuteHandlers() throws Exception 46 | { 47 | routeOptions = new JSONObject("{ \"handlers\" : [\"testHandler\"] }"); 48 | Map handlers = new HashMap(); 49 | handlers.put("testHandler", new Handler() 50 | { 51 | @Override 52 | public Map execute(Map routeParameters) 53 | { 54 | routeParameters.put("name", "value"); 55 | return routeParameters; 56 | } 57 | }); 58 | 59 | Map expected = new HashMap(); 60 | expected.put("name", "value"); 61 | 62 | assertEquals(HandlerExecutor.executeHandlers(routeOptions, new HashMap(), handlers), expected); 63 | } 64 | 65 | public void testExecuteHandlersExecuteInOrder() throws Exception 66 | { 67 | routeOptions = new JSONObject("{ \"handlers\" : [\"testHandler\", \"testHandler2\"] }"); 68 | Map handlers = new HashMap(); 69 | handlers.put("testHandler", new Handler() 70 | { 71 | @Override 72 | public Map execute(Map routeParameters) 73 | { 74 | routeParameters.put("name", "value"); 75 | return routeParameters; 76 | } 77 | }); 78 | handlers.put("testHandler2", new Handler() 79 | { 80 | @Override 81 | public Map execute(Map routeParameters) 82 | { 83 | routeParameters.put("name", "value2"); 84 | return routeParameters; 85 | } 86 | }); 87 | 88 | Map expected = new HashMap(); 89 | expected.put("name", "value2"); 90 | 91 | assertEquals(HandlerExecutor.executeHandlers(routeOptions, new HashMap(), handlers), expected); 92 | } 93 | 94 | public void testExecuteHandlersExecuteInDifferentOrder() throws Exception 95 | { 96 | routeOptions = new JSONObject("{ \"handlers\" : [\"testHandler2\", \"testHandler\"] }"); 97 | Map handlers = new HashMap(); 98 | handlers.put("testHandler", new Handler() 99 | { 100 | @Override 101 | public Map execute(Map routeParameters) 102 | { 103 | routeParameters.put("name", "value"); 104 | return routeParameters; 105 | } 106 | }); 107 | handlers.put("testHandler2", new Handler() 108 | { 109 | @Override 110 | public Map execute(Map routeParameters) 111 | { 112 | routeParameters.put("name", "value2"); 113 | return routeParameters; 114 | } 115 | }); 116 | 117 | Map expected = new HashMap(); 118 | expected.put("name", "value"); 119 | 120 | assertEquals(HandlerExecutor.executeHandlers(routeOptions, new HashMap(), handlers), expected); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/instrumentTest/java/org/mobiledeeplinking/android/MobileDeepLinkingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.net.Uri; 28 | 29 | import junit.framework.TestCase; 30 | 31 | public class MobileDeepLinkingTest extends TestCase 32 | { 33 | MobileDeepLinking mobileDeepLinking = new MobileDeepLinking(); 34 | 35 | public void setUp() throws Exception 36 | { 37 | super.setUp(); 38 | } 39 | 40 | public void testOnCreate() throws Exception 41 | { 42 | 43 | } 44 | 45 | public void testRegisterHandler() throws Exception 46 | { 47 | 48 | } 49 | 50 | public void testTrimDeeplink() throws Exception 51 | { 52 | Uri deeplink = Uri.parse("mdldemo://data/54?name=value&name1=value1"); 53 | Uri expected = Uri.parse("mdldemo://data?name=value&name1=value1"); 54 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 55 | 56 | assertEquals(returned.getScheme(), expected.getScheme()); 57 | assertEquals(returned.getPath(), expected.getPath()); 58 | assertEquals(returned.getQuery(), expected.getQuery()); 59 | } 60 | 61 | public void testTrimDeeplinkWithTrailingSlashes() throws Exception 62 | { 63 | Uri deeplink = Uri.parse("mdldemo://data/54/?name=value&name1=value1"); 64 | Uri expected = Uri.parse("mdldemo://data?name=value&name1=value1"); 65 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 66 | assertEquals(returned.getScheme(), expected.getScheme()); 67 | assertEquals(returned.getPath(), expected.getPath()); 68 | assertEquals(returned.getQuery(), expected.getQuery()); 69 | 70 | 71 | deeplink = Uri.parse("mdldemo://data/54//////?name=value&name1=value1"); 72 | expected = Uri.parse("mdldemo://data?name=value&name1=value1"); 73 | returned = mobileDeepLinking.trimDeeplink(deeplink); 74 | 75 | assertEquals(returned.getScheme(), expected.getScheme()); 76 | assertEquals(returned.getPath(), expected.getPath()); 77 | assertEquals(returned.getQuery(), expected.getQuery()); 78 | } 79 | 80 | public void testTrimDeeplinkWithoutPath() throws Exception 81 | { 82 | Uri deeplink = Uri.parse("mdldemo://data?name=value&name1=value1"); 83 | Uri expected = Uri.parse("mdldemo://?name=value&name1=value1"); 84 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 85 | assertEquals(returned.getScheme(), expected.getScheme()); 86 | assertEquals(returned.getPath(), expected.getPath()); 87 | assertEquals(returned.getQuery(), expected.getQuery()); 88 | } 89 | 90 | public void testTrimDeeplinkWithoutHostAndPath() throws Exception 91 | { 92 | Uri deeplink = Uri.parse("mdldemo://?name=value&name1=value1"); 93 | Uri expected = Uri.parse("mdldemo://?name=value&name1=value1"); 94 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 95 | 96 | assertEquals(returned.getScheme(), expected.getScheme()); 97 | assertEquals(returned.getPath(), expected.getPath()); 98 | assertEquals(returned.getQuery(), expected.getQuery()); 99 | } 100 | 101 | public void testTrimDeeplinkWithLongPath() throws Exception 102 | { 103 | Uri deeplink = Uri.parse("mdldemo://data/32/hello/there?name=value&name1=value1"); 104 | Uri expected = Uri.parse("mdldemo://data/32/hello?name=value&name1=value1"); 105 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 106 | 107 | assertEquals(returned.getScheme(), expected.getScheme()); 108 | assertEquals(returned.getPath(), expected.getPath()); 109 | assertEquals(returned.getQuery(), expected.getQuery()); 110 | } 111 | 112 | public void testTrimDeeplinkWithHost() throws Exception 113 | { 114 | Uri deeplink = Uri.parse("mdldemo://data?name=value&name1=value1"); 115 | Uri expected = Uri.parse("mdldemo://?name=value&name1=value1"); 116 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 117 | 118 | assertEquals(returned.getScheme(), expected.getScheme()); 119 | assertEquals(returned.getPath(), expected.getPath()); 120 | assertEquals(returned.getQuery(), expected.getQuery()); 121 | } 122 | 123 | public void testTrimDeeplinkWithHost2() throws Exception 124 | { 125 | Uri deeplink = Uri.parse("mdldemo://data/3"); 126 | Uri expected = Uri.parse("mdldemo://"); 127 | Uri returned = mobileDeepLinking.trimDeeplink(deeplink); 128 | 129 | assertEquals(returned.getScheme(), expected.getScheme()); 130 | assertEquals(returned.getPath(), expected.getPath()); 131 | assertEquals(returned.getQuery(), expected.getQuery()); 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | public class Constants 28 | { 29 | public static final String MOBILEDEEPLINKING_CONFIG_NAME = "MobileDeepLinkingConfig"; 30 | public static final String ROUTES_JSON_NAME = "routes"; 31 | public static final String STORYBOARD_JSON_NAME = "storyboard"; 32 | public static final String HANDLERS_JSON_NAME = "handlers"; 33 | public static final String CLASS_JSON_NAME = "class"; 34 | public static final String IDENTIFIER_JSON_NAME = "identifier"; 35 | public static final String LOGGING_JSON_NAME = "logging"; 36 | public static final String DEFAULT_ROUTE_JSON_NAME = "defaultRoute"; 37 | public static final String ROUTE_PARAMS_JSON_NAME = "routeParameters"; 38 | public static final String REQUIRED_JSON_NAME = "required"; 39 | public static final String REGEX_JSON_NAME = "regex"; 40 | public static final String STORYBOARD_IPHONE_NAME = "iPhone"; 41 | public static final String STORYBOARD_IPAD_NAME = "iPad"; 42 | } 43 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/DeeplinkMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.net.Uri; 28 | import android.text.TextUtils; 29 | 30 | import org.json.JSONException; 31 | import org.json.JSONObject; 32 | 33 | import java.util.ArrayList; 34 | import java.util.Arrays; 35 | import java.util.HashMap; 36 | import java.util.Iterator; 37 | import java.util.LinkedList; 38 | import java.util.List; 39 | import java.util.Map; 40 | 41 | public class DeeplinkMatcher 42 | { 43 | public static Map match(String route, JSONObject routeOptions, Map routeParameters, Uri deeplink) throws JSONException 44 | { 45 | Map results = new HashMap(routeParameters); 46 | results = matchPathParameters(route, routeOptions, deeplink, results); 47 | if (results == null) 48 | { 49 | return null; 50 | } 51 | results = matchQueryParameters(routeOptions, deeplink.getEncodedQuery(), results); 52 | if (results == null) 53 | { 54 | return null; 55 | } 56 | 57 | if (checkForRequiredRouteParameters(routeOptions, results)) 58 | { 59 | return results; 60 | } 61 | 62 | return null; 63 | } 64 | 65 | static Map matchPathParameters(String route, JSONObject routeOptions, Uri deeplink, Map results) 66 | { 67 | List routeComponents = new LinkedList(Arrays.asList(route.split("/"))); 68 | List deeplinkComponents = new LinkedList(deeplink.getPathSegments()); 69 | 70 | if (!route.startsWith("/")) 71 | { 72 | String host = deeplink.getHost(); 73 | if (!routeComponents.get(0).equals(host)) 74 | { 75 | return null; 76 | } 77 | routeComponents.remove(0); 78 | } 79 | 80 | if (routeComponents.size() != deeplinkComponents.size()) 81 | { 82 | return null; 83 | } 84 | 85 | String routeComponent; 86 | String deeplinkComponent; 87 | 88 | for (int i = 0; i < routeComponents.size(); i++) 89 | { 90 | routeComponent = routeComponents.get(i); 91 | deeplinkComponent = deeplinkComponents.get(i); 92 | if (!routeComponent.equals(deeplinkComponent)) 93 | { 94 | if (routeComponent.startsWith(":")) 95 | { 96 | String routeComponentName = routeComponent.substring(1); 97 | if (validateRouteComponent(routeComponentName, deeplinkComponent, routeOptions)) 98 | { 99 | results.put(routeComponentName, deeplinkComponent); 100 | } else 101 | { 102 | return null; 103 | } 104 | } else 105 | { 106 | return null; 107 | } 108 | } 109 | 110 | } 111 | 112 | return results; 113 | } 114 | 115 | static Boolean validateRouteComponent(String routeComponentName, String deeplinkComponent, JSONObject routeOptions) 116 | { 117 | try 118 | { 119 | JSONObject routeParameters = routeOptions.getJSONObject(Constants.ROUTE_PARAMS_JSON_NAME); 120 | JSONObject pathComponentParameters = routeParameters.getJSONObject(routeComponentName); 121 | 122 | String regexString = pathComponentParameters.getString(Constants.REGEX_JSON_NAME); 123 | if (!TextUtils.isEmpty(regexString)) 124 | { 125 | return deeplinkComponent.matches(regexString); 126 | } 127 | } 128 | catch (JSONException e) 129 | { 130 | // Route Component has no associated route parameters. Default to valid. 131 | } 132 | return Boolean.TRUE; 133 | } 134 | 135 | static Map matchQueryParameters(JSONObject routeOptions, String deeplinkQuery, Map results) throws JSONException 136 | { 137 | JSONObject routeParameters = null; 138 | if (routeOptions.has(Constants.ROUTE_PARAMS_JSON_NAME)) 139 | { 140 | routeParameters = routeOptions.getJSONObject(Constants.ROUTE_PARAMS_JSON_NAME); 141 | if (deeplinkQuery != null) { 142 | List queryPairs = Arrays.asList(deeplinkQuery.split("&")); 143 | for (String query : queryPairs) 144 | { 145 | List nameAndValue = Arrays.asList(query.split("=")); 146 | if (nameAndValue.size() == 2) 147 | { 148 | String name = Uri.decode(nameAndValue.get(0)); 149 | if (!routeParameters.has(name)) 150 | { 151 | continue; 152 | } 153 | 154 | String value = Uri.decode(nameAndValue.get(1)); 155 | if (validateRouteComponent(name, value, routeOptions)) 156 | { 157 | results.put(name, value); 158 | } else 159 | { 160 | MDLLog.e("DeeplinkMatcher", "Query Parameter Regex Checking failed."); 161 | return null; 162 | } 163 | } 164 | } 165 | } 166 | } 167 | return results; 168 | } 169 | 170 | static Boolean checkForRequiredRouteParameters(JSONObject routeOptions, Map results) throws JSONException 171 | { 172 | List requiredRouteParameterValues = getRequiredRouteParameterValues(routeOptions); 173 | for (String requiredValue : requiredRouteParameterValues) 174 | { 175 | if (results.get(requiredValue) == null) 176 | { 177 | MDLLog.e("DeeplinkMatcher", "Required route parameter is missing."); 178 | return Boolean.FALSE; 179 | } 180 | } 181 | return Boolean.TRUE; 182 | } 183 | 184 | static List getRequiredRouteParameterValues(JSONObject routeOptions) throws JSONException 185 | { 186 | List requiredRouteParameters = new ArrayList(); 187 | if (routeOptions.has(Constants.ROUTE_PARAMS_JSON_NAME)) 188 | { 189 | JSONObject routeParameters = routeOptions.getJSONObject(Constants.ROUTE_PARAMS_JSON_NAME); 190 | Iterator keys = routeParameters.keys(); 191 | 192 | while (keys.hasNext()) 193 | { 194 | String key = keys.next(); 195 | JSONObject routeParameterOptions = routeParameters.getJSONObject(key); 196 | if (routeParameterOptions.has(Constants.REQUIRED_JSON_NAME) && routeParameterOptions.getString(Constants.REQUIRED_JSON_NAME).equals("true")) 197 | { 198 | requiredRouteParameters.add(key); 199 | } 200 | } 201 | } 202 | return requiredRouteParameters; 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/Handler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import java.util.Map; 28 | 29 | public interface Handler 30 | { 31 | public Map execute(Map routeParameters); 32 | } 33 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/HandlerExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.text.TextUtils; 28 | 29 | import org.json.JSONArray; 30 | import org.json.JSONException; 31 | import org.json.JSONObject; 32 | 33 | import java.util.Map; 34 | 35 | public class HandlerExecutor 36 | { 37 | public static Map executeHandlers(JSONObject routeOptions, Map routeParameters, Map handlers) throws JSONException 38 | { 39 | if (routeOptions.has(Constants.HANDLERS_JSON_NAME) && !TextUtils.isEmpty(routeOptions.getString(Constants.HANDLERS_JSON_NAME))) 40 | { 41 | JSONArray routeHandlers = routeOptions.getJSONArray(Constants.HANDLERS_JSON_NAME); 42 | for (int i = 0; i < routeHandlers.length(); i++) 43 | { 44 | Handler handler = handlers.get(routeHandlers.get(i)); 45 | if (handler != null) 46 | { 47 | routeParameters = handler.execute(routeParameters); 48 | } else 49 | { 50 | MDLLog.e("MobileDeepLinking", "Handler " + routeHandlers.get(i) + " has not been registered with the MobileDeepLinking library."); 51 | } 52 | } 53 | } 54 | return routeParameters; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/IntentBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.content.Context; 28 | import android.content.Intent; 29 | 30 | import org.json.JSONException; 31 | import org.json.JSONObject; 32 | 33 | import java.util.Map; 34 | 35 | public class IntentBuilder 36 | { 37 | public static void buildAndFireIntent(JSONObject routeOptions, Map routeParameters, Context context) throws JSONException 38 | { 39 | String activityName = routeOptions.getString(Constants.CLASS_JSON_NAME); 40 | try 41 | { 42 | Intent intent = new Intent(context, Class.forName(activityName)); 43 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 44 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 45 | 46 | if (routeParameters != null) 47 | { 48 | for (Map.Entry param : routeParameters.entrySet()) 49 | { 50 | intent.putExtra(param.getKey(), param.getValue()); 51 | } 52 | } 53 | context.startActivity(intent); 54 | } 55 | catch (ClassNotFoundException e) 56 | { 57 | MDLLog.e("IntentBuilder", "Activity in JSON not found."); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/MDLLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | public class MDLLog 28 | { 29 | public static Boolean loggingEnabled = Boolean.FALSE; 30 | 31 | public static void d(String tag, String message) 32 | { 33 | if (Boolean.TRUE.equals(loggingEnabled)) 34 | { 35 | android.util.Log.d(tag, message); 36 | } 37 | } 38 | 39 | public static void d(String tag, String message, Exception e) 40 | { 41 | if (Boolean.TRUE.equals(loggingEnabled)) 42 | { 43 | android.util.Log.d(tag, message, e); 44 | } 45 | } 46 | 47 | public static void e(String tag, String message) 48 | { 49 | if (Boolean.TRUE.equals(loggingEnabled)) 50 | { 51 | android.util.Log.e(tag, message); 52 | } 53 | } 54 | 55 | public static void e(String tag, String message, Exception e) 56 | { 57 | if (Boolean.TRUE.equals(loggingEnabled)) 58 | { 59 | android.util.Log.e(tag, message, e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/MobileDeepLinking.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import android.app.Activity; 28 | import android.content.res.AssetManager; 29 | import android.content.res.Resources; 30 | import android.net.Uri; 31 | import android.os.Bundle; 32 | import android.text.TextUtils; 33 | 34 | import org.json.JSONException; 35 | import org.json.JSONObject; 36 | 37 | import java.io.BufferedReader; 38 | import java.io.IOException; 39 | import java.io.InputStream; 40 | import java.io.InputStreamReader; 41 | import java.util.HashMap; 42 | import java.util.Iterator; 43 | import java.util.LinkedList; 44 | import java.util.List; 45 | import java.util.Map; 46 | 47 | public class MobileDeepLinking extends Activity 48 | { 49 | private static Map handlers = null; 50 | private static MobileDeepLinkingConfig config = null; 51 | 52 | public MobileDeepLinking() 53 | { 54 | } 55 | 56 | @Override 57 | protected void onCreate(Bundle savedInstanceState) 58 | { 59 | super.onCreate(savedInstanceState); 60 | // Read JSON file and then route to the appropriate place. 61 | if (config == null) 62 | { 63 | config = getConfiguration(); 64 | MDLLog.loggingEnabled = config.getLogging(); 65 | } 66 | 67 | try 68 | { 69 | routeUsingUrl(this.getIntent().getData()); 70 | } 71 | catch (JSONException e) 72 | { 73 | MDLLog.e("MobileDeepLinking", "Error parsing JSON!", e); 74 | throw new RuntimeException(); 75 | } 76 | } 77 | 78 | public static void registerHandler(String name, org.mobiledeeplinking.android.Handler handler) 79 | { 80 | if (handlers == null) 81 | { 82 | handlers = new HashMap(); 83 | } 84 | handlers.put(name, handler); 85 | } 86 | 87 | private void routeUsingUrl(Uri deeplink) throws JSONException 88 | { 89 | // base case 90 | if (TextUtils.isEmpty(deeplink.getHost()) && (TextUtils.isEmpty(deeplink.getPath()))) 91 | { 92 | MDLLog.e("MobileDeepLinking", "No Routes Match."); 93 | routeToDefault(); 94 | return; 95 | } 96 | 97 | Iterator keys = config.getRoutes().keys(); 98 | while (keys.hasNext()) 99 | { 100 | String route = keys.next(); 101 | JSONObject routeOptions = (JSONObject) config.getRoutes().get(route); 102 | try 103 | { 104 | Map routeParameters = new HashMap(); 105 | routeParameters = DeeplinkMatcher.match(route, routeOptions, routeParameters, deeplink); 106 | if (routeParameters != null) 107 | { 108 | handleRoute(routeOptions, routeParameters); 109 | return; 110 | } 111 | } 112 | catch (JSONException e) 113 | { 114 | MDLLog.e("MobileDeepLinking", "Error parsing JSON!", e); 115 | break; 116 | } 117 | catch (Exception e) 118 | { 119 | MDLLog.e("MobileDeepLinking", "Error matching and handling route", e); 120 | break; 121 | } 122 | } 123 | 124 | // deeplink trimmer 125 | routeUsingUrl(trimDeeplink(deeplink)); 126 | } 127 | 128 | private void routeToDefault() throws JSONException 129 | { 130 | MDLLog.d("MobileDeepLinking", "Routing to Default Route."); 131 | handleRoute(config.getDefaultRoute(), null); 132 | } 133 | 134 | Uri trimDeeplink(Uri deeplink) 135 | { 136 | String host = deeplink.getHost(); 137 | List pathSegments = new LinkedList(deeplink.getPathSegments()); 138 | if (pathSegments.isEmpty()) 139 | { 140 | // trim off host 141 | if (!TextUtils.isEmpty(host)) 142 | { 143 | host = null; 144 | } 145 | } 146 | 147 | for (int i = pathSegments.size() - 1; i >= 0; i--) 148 | { 149 | // remove trailing slashes 150 | if (pathSegments.get(i).equals("/")) 151 | { 152 | pathSegments.remove(i); 153 | } else 154 | { 155 | pathSegments.remove(i); 156 | break; 157 | } 158 | } 159 | 160 | String pathString = ""; 161 | for (int i = 0; i < pathSegments.size(); i++) 162 | { 163 | pathString += "/"; 164 | pathString += pathSegments.get(i); 165 | } 166 | 167 | Uri.Builder builder = new Uri.Builder(); 168 | builder.scheme(deeplink.getScheme()); 169 | builder.path(pathString); 170 | builder.query(deeplink.getQuery()); 171 | 172 | return builder.build(); 173 | } 174 | 175 | private void handleRoute(JSONObject routeOptions, Map routeParameters) throws JSONException 176 | { 177 | HandlerExecutor.executeHandlers(routeOptions, routeParameters, handlers); 178 | IntentBuilder.buildAndFireIntent(routeOptions, routeParameters, this); 179 | } 180 | 181 | private MobileDeepLinkingConfig getConfiguration() 182 | { 183 | try 184 | { 185 | String jsonString = readConfigFile(); 186 | JSONObject json = new JSONObject(jsonString); 187 | return new MobileDeepLinkingConfig(json); 188 | } 189 | catch (IOException e) 190 | { 191 | e.printStackTrace(); 192 | } 193 | catch (JSONException e) 194 | { 195 | e.printStackTrace(); 196 | } 197 | 198 | return null; 199 | } 200 | 201 | private String readConfigFile() throws IOException 202 | { 203 | Resources resources = this.getApplicationContext().getResources(); 204 | AssetManager assetManager = resources.getAssets(); 205 | 206 | InputStream inputStream = assetManager.open("MobileDeepLinkingConfig.json"); 207 | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8); 208 | StringBuilder sb = new StringBuilder(); 209 | 210 | String line; 211 | while ((line = reader.readLine()) != null) 212 | { 213 | sb.append(line + "\n"); 214 | } 215 | return sb.toString(); 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/java/org/mobiledeeplinking/android/MobileDeepLinkingConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by MobileDeepLinking.org 3 | * 4 | * Permission is hereby granted, free of charge, to any 5 | * person obtaining a copy of this software and 6 | * associated documentation files (the "Software"), to 7 | * deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the 10 | * Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall 14 | * be included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package org.mobiledeeplinking.android; 26 | 27 | import org.json.JSONException; 28 | import org.json.JSONObject; 29 | 30 | public class MobileDeepLinkingConfig 31 | { 32 | private Boolean logging; 33 | private JSONObject storyboard; 34 | private JSONObject routes; 35 | private JSONObject defaultRoute; 36 | 37 | 38 | public MobileDeepLinkingConfig(JSONObject json) 39 | { 40 | try 41 | { 42 | logging = Boolean.valueOf(json.getString(Constants.LOGGING_JSON_NAME)); 43 | storyboard = json.getJSONObject(Constants.ROUTES_JSON_NAME); 44 | routes = json.getJSONObject(Constants.ROUTES_JSON_NAME); 45 | defaultRoute = json.getJSONObject(Constants.DEFAULT_ROUTE_JSON_NAME); 46 | } 47 | catch (JSONException e) 48 | { 49 | e.printStackTrace(); 50 | } 51 | } 52 | 53 | public Boolean getLogging() 54 | { 55 | return logging; 56 | } 57 | 58 | public void setLogging(Boolean logging) 59 | { 60 | this.logging = logging; 61 | } 62 | 63 | public JSONObject getStoryboard() 64 | { 65 | return storyboard; 66 | } 67 | 68 | public JSONObject getRoutes() 69 | { 70 | return routes; 71 | } 72 | 73 | public JSONObject getDefaultRoute() 74 | { 75 | return defaultRoute; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-SDK/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-SDK/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-SDK/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/MobileDeepLinking-Android-SDK/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MobileDeepLinking-Android-SDK/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MobileDeepLinking-Android 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This Repository is no longer maintained. 2 | Issue reports and pull requests will not be attended. 3 | 4 | # MobileDeepLinking-Android [![Build Status](https://travis-ci.org/mobiledeeplinking/mobiledeeplinking-android.png?branch=master)](https://travis-ci.org/mobiledeeplinking/mobiledeeplinking-android) 5 | 6 | This project is the Android component of the MobileDeepLinking specification, the industry standard for mobile application deeplinking. This spec and accompanying libraries simplify and reduce implementation time of deep links as well as provide flexible and powerful features for routing to custom behavior. 7 | 8 | ## Features 9 | 10 | Give a configuration file (`MobileDeepLinkingConfig.json`), this library provides the ability to define deeplink routes that map to custom logic and activity creation. This is accomplished through custom callback handlers and by creating Intent objects that are used to start new activities. 11 | 12 | ### Activity Routing 13 | 14 | When a class is defined in the configuration file, the library will create an Intent that will be used to start the appropriate Activity. The route parameters defined in the configuration file (path and query parameters) will be set as extras on the intent. The `class` attribute in the json configuration must be a fully qualified class name with package info included. 15 | 16 | ### Handlers 17 | 18 | There may be cases where you wish to do more than simply route to an Activity. This functionality is supported through the use of custom handlers. In your subclass of the `Application` class, you can implement the `org.mobiledeeplinking.android.Handler` interface in order to register custom logic to be executed when a route matches. This association takes place in the configuration json under the `handlers` attribute. 19 | 20 | These handlers are provided with a HashMap with all route parameters found in the deeplink. The handlers can modify the contents of this map, which will then be forwarded on to the next handler in the handlers array found in the json. Handlers can be reused across multiple routes and can be used in conjunction with view instantiation or entirely on their own. 21 | 22 | ## Compatibility 23 | 24 | Supports Android 2.2 and above. 25 | 26 | ## Build 27 | 28 | Development uses the Gradle build system introduced with Android Studio. To build for release: 29 | 30 | 1. `./gradlew clean assembleRelease` 31 | 2. The resulting library can be found in `MobileDeepLinking-Android-SDK/build/libs/MobileDeepLinking-Android-SDK.aar`. 32 | 3. If you wish to build the library in a jar, execute `./gradlew clean packageReleaseJar` 33 | 4. The resulting jar can be found in `MobileDeepLinking-Android-SDK/build/bundles/release/classes.jar`. Rename this file to `MobileDeepLinking-Android-SDK.jar`. 34 | 35 | ## Installation 36 | 37 | ### Required 38 | 39 | Create a `MobileDeepLinkingConfig.json` file in your project with desired routes and options. See demo app and spec for the schema and examples. 40 | 41 | Drop the MobileDeepLinking-Android-SDK `.aar` or `.jar` file into your `libs/` folder. 42 | 43 | Insert the following into your `AndroidManifest.xml`: 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Where {DEEP_LINK_SCHEME} is replaced with your desired scheme. For example, replacing it with `mdldemo` would map the url scheme `mdldemo://` to your app. 59 | 60 | ### Optional 61 | 62 | Register Custom Handlers (if desired) in a subclass of your app's `Application` class: 63 | 64 | public class MDLApplication extends Application 65 | { 66 | @Override 67 | public void onCreate() 68 | { 69 | super.onCreate(); 70 | MobileDeepLinking.registerHandler("testHandler", new org.mobiledeeplinking.android.Handler() 71 | { 72 | @Override 73 | public Map execute(Map routeParameters) 74 | { 75 | // inside handler 76 | return routeParameters; 77 | } 78 | }); 79 | } 80 | } 81 | 82 | ## Demo App 83 | 84 | Part of the `MobileDeepLinking-Android.iml` project consists of a demo app, `MobileDeepLinking-Android-Demo`. This is a demo application that provides an example implementation of the `MobileDeepLinkingConfig.json` file, along with several custom handlers that demonstrate how to route to client-specified functionality. It also provides example routing to several different activities. 85 | 86 | ## License 87 | 88 | Copyright 2014 MobileDeepLinking.org and other contributors 89 | http://mobiledeeplinking.org 90 | 91 | Permission is hereby granted, free of charge, to any person obtaining 92 | a copy of this software and associated documentation files (the 93 | "Software"), to deal in the Software without restriction, including 94 | without limitation the rights to use, copy, modify, merge, publish, 95 | distribute, sublicense, and/or sell copies of the Software, and to 96 | permit persons to whom the Software is furnished to do so, subject to 97 | the following conditions: 98 | 99 | The above copyright notice and this permission notice shall be 100 | included in all copies or substantial portions of the Software. 101 | 102 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 103 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 104 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 105 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 106 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 107 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 108 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 109 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | jcenter() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ci/wait_for_emulator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bootanim="" 4 | failcounter=0 5 | until [[ "$bootanim" =~ "stopped" ]]; do 6 | bootanim=`adb -e shell getprop init.svc.bootanim 2>&1` 7 | echo "$bootanim" 8 | if [[ "$bootanim" =~ "not found" ]]; then 9 | let "failcounter += 1" 10 | if [[ $failcounter -gt 3 ]]; then 11 | echo "Failed to start emulator" 12 | exit 1 13 | fi 14 | fi 15 | sleep 1 16 | done 17 | echo "Done" 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jun 01 15:05:22 SGT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /releases/0.1.0/MobileDeepLinking-Android-SDK.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.0/MobileDeepLinking-Android-SDK.aar -------------------------------------------------------------------------------- /releases/0.1.0/MobileDeepLinking-Android-SDK.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.0/MobileDeepLinking-Android-SDK.jar -------------------------------------------------------------------------------- /releases/0.1.1/MobileDeepLinking-Android-SDK.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.1/MobileDeepLinking-Android-SDK.aar -------------------------------------------------------------------------------- /releases/0.1.1/MobileDeepLinking-Android-SDK.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.1/MobileDeepLinking-Android-SDK.jar -------------------------------------------------------------------------------- /releases/0.1.2/MobileDeepLinking-Android-SDK.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.2/MobileDeepLinking-Android-SDK.aar -------------------------------------------------------------------------------- /releases/0.1.2/MobileDeepLinking-Android-SDK.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobiledeeplinking/mobiledeeplinking-android/9beae25c80eb1f4106979d0f48bd41ada8785e44/releases/0.1.2/MobileDeepLinking-Android-SDK.jar -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':MobileDeepLinking-Android-Demo', 'MobileDeepLinking-Android-SDK' 2 | --------------------------------------------------------------------------------