A lightweight and simple Kotlin library for deep link handling on Android πŸ”—.

Overview

Linkt

A lightweight and simple kotlin library for deep link handling on Android.

Setup

Configure root build.gradle (jitpack.io):

allprojects {  
    repositories {  
        ...  
        maven { url 'https://jitpack.io' }  
    }  
}  

Add Linkt to your project build.gradle:

dependencies {
  implementation 'com.github.jeziellago:Linkt:TAG'
}
  1. Create your DeepLinkModule and register deep links:
Intent(context, MainActivity::class.java) .apply { putExtras(bundle) } } } } ">
class MyDeepLinkModule : DeepLinkModule {

    override fun load() {
        deepLinkOf(
            "linkt://sample",
            "linkt://sample/{userId}/{userName}"
        ) { context, bundle ->
            Intent(context, MainActivity::class.java)
                .apply { putExtras(bundle) }
        }
    }
}

In multi-module projects you should have one or more DeepLinkModule`s.

  1. Register your modules into Application#onCreate, with DeepLinkLoader#setup:
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        DeepLinkLoader.setup(MyDeepLinkModule())
    }
}
  1. Create the DeepLinkActivity (or use yours if already exists), and call DeepLinkLoader#loadFrom:
class DeepLinkActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // resolve deeplink
        DeepLinkLoader.loadFrom(this)
    }
}

Don't forget to configure AndroidManifest.xml (required for Android deep links):

">
<activity
    android:name="org.linkt.DeepLinkActivity"
    android:theme="@android:style/Theme.NoDisplay">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="mycompany" />
    intent-filter>
activity>

How to get data from deeplink?

In your activity, you can get path parameters and query values as String from intent.extras:

Path parameters

  • Template linkt://sample/{userId}/{userName}
  • Received: linkt://sample/9999/Jose
// get path parameters
val userId = intent.extras.getString("userId")
val userId = intent.extras.getString("userName")

Query parameters

  • Template: linkt://sample
  • Received linkt://sample?subject=Linkt&name=Sample
// get query parameters
val subject = intent.extras.getString("subject")
val name = intent.extras.getString("name")

Path + query parameters

  • Template linkt://sample/{userId}/{userName}
  • Received linkt://sample/999/Jose?subject=Linkt&name=Sample
// get path parameters
val userId = intent.extras.getString("userId")
val userId = intent.extras.getString("userName")
// get query parameters
val subject = intent.extras.getString("subject")
val name = intent.extras.getString("name")

Licence

Copyright (c) 2021 Jeziel Lago

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You might also like...
Koi, a lightweight kotlin library for Android Development.

Koi - A lightweight Kotlin library for Android Koi include many useful extensions and functions, they can help reducing the boilerplate code in Androi

A lightweight cache library written in Kotlin

[NEW] Released to Maven Central: 'com.github.yundom:kache:1.x.x' Kache A runtime in-memory cache. Installation Put this in your build.gradle implemen

Lightweight Kotlin DSL dependency injection library
Lightweight Kotlin DSL dependency injection library

Warehouse DSL Warehouse is a lightweight Kotlin DSL dependency injection library this library has an extremely faster learning curve and more human fr

A fast, lightweight, entity component system library written in Kotlin.

Fleks A fast, lightweight, entity component system library written in Kotlin. Motivation When developing my hobby games using LibGDX, I always used As

Kotools Types - a lightweight library that provides commonly used types for Kotlin

Kotools Types is a lightweight library that provides commonly used types for Kotlin

Lightweight data loading and caching library for android

ColdStorage A lightweight data loading and caching library for android Quicklinks Feature requests: Got a new requirement? Request it here and it will

Clickstream - A Modern, Fast, and Lightweight Android Library Ingestion Platform.
Clickstream - A Modern, Fast, and Lightweight Android Library Ingestion Platform.

Clickstream is an event agnostic, real-time data ingestion platform. Clickstream allows apps to maintain a long-running connection to send data in real-time.

StaticLog - super lightweight static logging for Kotlin, Java and Android
StaticLog - super lightweight static logging for Kotlin, Java and Android

StaticLog StaticLog is a super lightweight logging library implemented in pure Kotlin (https://kotlinlang.org). It is designed to be used in Kotlin, J

A Lightweight PDF Viewer Android library which only occupies around 125kb while most of the Pdf viewer occupies up to 16MB space.
A Lightweight PDF Viewer Android library which only occupies around 125kb while most of the Pdf viewer occupies up to 16MB space.

Pdf Viewer For Android A Simple PDF Viewer library which only occupies around 125kb while most of the Pdf viewer occupies upto 16MB space. How to inte

Releases(0.1.1)
Owner
Jeziel Lago
Jeziel Lago
A simple solution to handling persistent data storage in your Minecraft server.

Modern Data Stores A simple solution to handling persistent data storage in your Minecraft server. This plugin will be used throughout the Modern Plug

Modern Plugins 2 Nov 7, 2022
On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

Picovoice 2.8k Dec 30, 2022
Link-converter - A web service that converts links between web url and deeplink for mobile and web applications

Deep Link Converter Linkleri, mobil ve web uygulamaları için web url ile deeplin

Muhammed Eren DURSUN 2 Apr 9, 2022
🀝 Link your Fabric server and Discord with ease!

Fabric2Discord Link your Fabric server and Discord with ease! ?? Getting Started I wrote few helpful articles about this mod, so if you need help you

Igor Ryzhenkov 10 Oct 25, 2022
Permissionmanager is a small wrapper for handling permission requests.

Permissionmanager Permissionmanager is a small wrapper for handling permission requests. Installation Add jitpack to your repositories in Project buil

Thomas Cirksena 11 Nov 17, 2020
Backing property explained - youtube video link in documnetation

backing property => Kotlin => Getter Setter and Backing Property Screenshot Inside android studio open a file press Alt+Shift+A and search for kotlin

Vishnu Sunilkumar 0 Nov 3, 2021
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru ?? Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

Noel 13 Dec 16, 2022
A lightweight, simple, smart and powerful Android routing library.

RxRouter Read this in other languages: δΈ­ζ–‡, English A lightweight, simple, smart and powerful Android routing library. Getting started Setting up the d

Season 323 Nov 10, 2022
Lightweight compiler plugin intended for Kotlin/JVM library development and symbol visibility control.

Restrikt A Kotlin/JVM compiler plugin to restrict symbols access, from external project sources. This plugin offers two ways to hide symbols: An autom

Lorris Creantor 18 Nov 24, 2022
Easy lightweight SharedPreferences library for Android in Kotlin using delegated properties

Easy lightweight SharedPreferences library for Android in Kotlin using delegated properties Idea Delegated properties in Kotlin allow you to execute a

null 25 Dec 27, 2022