Convert KAPT to KSP - Room and Hilt Examples
Android Kotlin Weekly
by Vincent Tsen
3M ago
KAPT stands for Kotlin Annotation Processing Tool and KSP stands for Kotlin Symbol Processing. Both are annotation-processing tools that are used for code generation. KAPT is the old way which is Java-based and KSP is the new way which is Kotlin-based, and it builds (generates codes) a lot faster than the KAPT. The 2 most common Android libraries that use them are Room Database and Hilt Dependency Injection. Let's explore the steps to convert these libraries from KAPT to KPT... 1. Update Kotlin version to minimum version "1.9.10" In your project build.gradle file (Groovy example): /*...*/plug ..read more
Visit website
Equivalent Perforce Shelving Command in GitHub
Android Kotlin Weekly
by Vincent Tsen
5M ago
In Perforce, you can shelve files. The idea allows you to save your temporary changes (shelve files) and retrieve them later (unshelve files). I'm a Perforce guy. So, I wonder what is the equivalent shelving files in GitHub? After doing some research, I think the equivalent Perforce shelving files command in GitHub is git stash. git stash is Similar to Shelving Files Well, it is not 100% equivalent. The key difference is git stash is purely local, while Perforce shelved files are in the server. Since it is local, you're the only one who can access the changes. If you want to share with others ..read more
Visit website
Integrate Firebase Realtime Database and User Authentication into your Android App
Android Kotlin Weekly
by Vincent Tsen
9M ago
This is part of the Firebase tutorial series: Part 1 - Simple Firebase Sign-in UI Demo App Part 2 - Integrate Firebase Realtime Database and User Authentication into your Android App This article is the continuity of the previous article, in which we learned how to create a simple Firebase sign-in/authentication in the Android app. So, this assumes you have already set up the Firebase console project for your app. The overview of the demo app looks like this. 1. Enable Realtime Database in Firebase Project On the left panel of your Firebase project, click Build -> Realtime Database ..read more
Visit website
How to Add Spotless Code Formatter to your Android Project?
Android Kotlin Weekly
by Vincent Tsen
10M ago
I have been seeing this spotless in many open-source codes, and it turns out it is a pretty popular coding style plugin for the Gradle build system used in Android development. So I gave it a try and use it in my project. Here are the steps I took to add this spotless plugin to my existing projects, which consist of both Kotlin script (KTS) and Groovy build Gradle files. 1. Add com.diffplug.spotless Plugin Add com.diffplug.spotless in the project-level build.gradle/.kts. KTS plugins { /*...*/ id("com.diffplug.spotless") version "6.19.0" apply false } Groovy plugins ..read more
Visit website
How to Request Android Runtime Permissions using Jetpack Compose?
Android Kotlin Weekly
by Vincent Tsen
10M ago
There are 2 types of permissions: Install-time permissions Runtime permissions An example of the most common install-time permissions is internet permissions. The Android OS system automatically grants your app the permission when the app is installed. You just need to declare the permission in the AndroidManifest.xml. Unlike runtime permissions, in addition to declaring the permissions in the AndroidManifest.xml, you also need to manually request the permissions in your app. There are some gotchas on requesting runtime permissions, which will be discussed later. Why Accompanist Permissi ..read more
Visit website
@RequiresApi() and @ChecksSdkIntAtLeast() Annotations
Android Kotlin Weekly
by Vincent Tsen
11M ago
One of the things I am confused about in Android development is these lint tool annotations. These annotations do not sound like lint tool annotations to me, but they are. So, I call them lint tool annotations because it makes them clear to me on their purposes which provides you with the proper lint warning/error messages to you in Android Studio. @RequiresAPI() Let's say you have a function that calls an Android API that requires min SDK 23, anything below 23 won't work. You annotate @RequiresAPI(23) in your function to let the caller knows that it won't work if the Android device is running ..read more
Visit website
Simple Preferences & Proto DataStore Demo App
Android Kotlin Weekly
by Vincent Tsen
11M ago
There are a few ways you can store data locally on your Android devices: SharedPreferences (replaced by Preferences DataStore) Preferences DataStore Proto DataStore Room Database SharedPreferences is the old way, which has been replaced by Preferences DataStore due to its shortcomings (e.g. not safe to be called from the UI thread). In this article, I'm going to share how to store data using both Preferences DataStore and Proto DataStore. Room Database will be covered later in the next article. Prefer which way to store data? Preferences DataStore stores data in a simple key-value f ..read more
Visit website
Simple Firebase Sign-in UI Demo App
Android Kotlin Weekly
by Vincent Tsen
1y ago
In this demo app, we will guide you through the steps to enable FirebaseUI for authentication and demonstrate how to integrate it into your Jetpack Compose application. We're going to add these 2 sign-in methods: Email/Password Google Connect Your App to Firebase Go to the Firebase console, and log in with your Google account. Add project and follow on-screen instructions Turn off Enable Google Analytics for this project, and click Create project. Register the app with Android package name (applicationId in your build.gradle file) Add app nickname (it can be any name) Add De ..read more
Visit website
How to add Google Play In-app Review Dialog?
Android Kotlin Weekly
by Vincent Tsen
1y ago
This is just a quick guide and a simple example of how to add the Google Play In-app review dialog in your app. This is what it looks like after I implemented this in RSS feed reader app. 1. Add Review API Libraries This example of build.gradle.kts (Kotlin script/KTS) in your app module. dependencies { /*...*/ implementation("com.google.android.play:review:2.0.1") implementation("com.google.android.play:review-ktx:2.0.1") /*...*/ } 2. Create ReviewManager in the Activity It is better to implement the ReviewManger in activity rather than a composable function because its APIs ..read more
Visit website
How to Add Deep Links in Jetpack Compose?
Android Kotlin Weekly
by Vincent Tsen
1y ago
This is part of the Jetpack Compose navigation series: Part 1 - Simple Jetpack Compose Navigation Example Part 2 - Compose Destinations - Navigation Library Part 3 - How to Add Bottom Navigation in Jetpack Compose? Part 4 - How to Add Navigation Drawer in Jetpack Compose? Part 5 - How to Add Deep Links in Jetpack Compose? A deep link is a hyperlink that takes you directly to a certain screen on your app. For example, clicking on my blog's URL, the Android OS shows a list of apps that can be used to open the URL as you can see below. Note: The UI above may look a bit different on d ..read more
Visit website

Follow Android Kotlin Weekly on FeedSpot

Continue with Google
Continue with Apple
OR