Book Image

Android Studio 3.5 Development Essentials - Kotlin Edition

By : Neil Smyth
Book Image

Android Studio 3.5 Development Essentials - Kotlin Edition

By: Neil Smyth

Overview of this book

Popularity of Kotlin as an Android-compatible language keeps growing every day. This book will help you to build your own Android applications using Kotlin. Android Studio 3.5 Development Essentials Kotlin Edition first teaches you to install Android development and test environment on different operating systems. Next, you will create an Android app and a virtual device in Android studio, and install an Android application on emulators. You will test apps on physical android devices, then study Android Studio code editor, Android architecture, and the anatomy of an Android app. The focus then shifts to Kotlin language. You’ll get an overview of Kotlin language and practice converting code from Java to Kotlin. You’ll also explore Kotlin data types, operators, expressions, loops, functions, and the basics of OOP concept in Kotlin. This book will then cover Android Jetpack and how to create an example app project using ViewModel component, as well as advanced topics such as views and widgets implementation, multi-window support integration, and biometric authentication. Finally, you will learn to upload your app to the Google Play Console and handle the build process with Gradle. By the end of this book, you will have gained enough knowledge to develop powerful Android applications using Kotlin.
Table of Contents (93 chapters)
93
Index

85.3 Handling App Link Intents

In most cases, the launched activity will need to gain access to the app link URL and to take specific action based on the way in which the URL is structured. Continuing from the above example, the activity will most likely display different content when launched via a URL containing a path of /welcome/newuser than one with the path set to /welcome/existinguser.

When the activity is launched by the link, it is passed an intent object containing data about the action which launched the activity including a Uri object containing the app link URL. Within the initialization stages of the activity, code can be added to extract this data as follows:

val appLinkIntent = intent

val appLinkAction = appLinkIntent.action

val appLinkData = appLinkIntent.data

Having obtained the Uri for the app link, the various components that make up the URL path can be used to make decisions about the actions to be performed within the activity. In the following...