Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Kotlin for Android 14

You're reading from  Mastering Kotlin for Android 14

Product type Book
Published in Apr 2024
Publisher Packt
ISBN-13 9781837631711
Pages 370 pages
Edition 1st Edition
Languages
Author (1):
Harun Wangereka Harun Wangereka
Profile icon Harun Wangereka

Table of Contents (22) Chapters

Preface 1. Part 1: Building Your App
2. Chapter 1: Get Started with Kotlin Android Development 3. Chapter 2: Creating Your First Android App 4. Chapter 3: Jetpack Compose Layout Basics 5. Chapter 4: Design with Material Design 3 6. Part 2: Using Advanced Features
7. Chapter 5: Architect Your App 8. Chapter 6: Network Calls with Kotlin Coroutines 9. Chapter 7: Navigating within Your App 10. Chapter 8: Persisting Data Locally and Doing Background Work 11. Chapter 9: Runtime Permissions 12. Part 3: Code Analysis and Tests
13. Chapter 10: Debugging Your App 14. Chapter 11: Enhancing Code Quality 15. Chapter 12: Testing Your App 16. Part 4: Publishing Your App
17. Chapter 13: Publishing Your App 18. Chapter 14: Continuous Integration and Continuous Deployment 19. Chapter 15: Improving Your App 20. Index 21. Other Books You May Enjoy

Improving Your App

After we complete the development and publishing of our app, it is important to always be on the lookout when using things that help improve our apps, such as Firebase Messaging or Crashlytics. We are going to be learning how to use Firebase Messaging and Crashlytics in this chapter.

In this chapter, we will learn step-by-step techniques on how to improve our apps by adding analytics—Firebase Crashlytics—and how to use cloud messaging to increase user engagement. We will learn how to send notifications to our apps from the Firebase console. Additionally, we will learn some tips and tricks for securing our apps to ensure that user data is not compromised.

In this chapter, we’re going to cover the following main topics:

  • Using Firebase Crashlytics to detect crashes
  • Improving app engagement with Firebase Messaging
  • Securing your app

Technical requirements

To follow the instructions in this chapter, you will need to have Android Studio Hedgehog or a later version (https://developer.android.com/studio) downloaded.

You can use the previous chapter’s code to follow the instructions in this chapter. You can find the code for this chapter on GitHub at https://github.com/PacktPublishing/Mastering-Kotlin-for-Android/tree/main/chapterfifteen.

Using Firebase Crashlytics to detect crashes

Crashes can happen in our apps for a variety of reasons, including common coding issues such as null pointer exceptions, memory leaks, and improper data handling. Device fragmentation caused by different device hardware configurations and different Android operation systems introduces compatibility issues that may at times cause crashes too. Network issues, insufficient resources, or mismanagement of external dependencies, such as third-party libraries, can cause crashes too. Sometimes, we can anticipate and handle them gracefully. Other times, they are unexpected and we need to know about them so we can fix them. Our app is already on Google Play Store, so at times, we might not have the luxury to debug on the devices that are having issues. Tools such as Firebase Crashlytics can help us detect crashes in our apps and provide us with the information we need to fix them. In this section, we will be setting up Firebase Crashlytics in our...

Improving app engagement with Firebase Messaging

When users install our app, they might not use it again after they finish what they want to do. This can lead to a decline in the number of active users, which can have different impacts on different apps.

We can leverage Firebase Cloud Messaging to send notifications to our users to remind them of our app. This will help us improve our app’s engagement and increase the number of active users. In this section, we will be setting up Firebase Cloud Messaging in our app and see how we can use it to send notifications to our app users.

First, we need to set up the Firebase Cloud Messaging SDK on our app. This allows us to use the SDK within our project and enables our app to receive Firebase notifications once the setup is complete. We will do it the same way we did for Firebase Crashlytics and Firebase Analytics. Repeat the following steps:

  1. Open the Firebase tool from Tools | Firebase.
  2. Select Cloud Messaging from...

Securing your app

Ensuring your apps are secure is particularly important. We need to ensure that our users’ data is safe and secure. We also need to ensure that our app is not vulnerable to attacks. Attacks such as malware, man-in-the-middle attacks, and data interception pose risks to sensitive information, while vulnerabilities such as SQL injection and privilege escalation can lead to unauthorized access and manipulation of databases or app functionalities. Cross-site scripting and code injection present avenues for attackers to execute malicious scripts or commands within the app, potentially compromising user sessions and data. Insecure data storage practices may expose sensitive information, and denial-of-service attacks can disrupt app services.

In this section, we are going to see some tips and tricks for securing our app. The following are some of the things that we can do to secure our app:

  • HTTPS: We should always use HTTPS for all our network requests...

Summary

In this chapter, we have learned techniques for improving our apps by adding analytics—in this case, Firebase Crashlytics—and how to use cloud messaging to increase user engagement in our apps. Additionally, we learned some tips and tricks for securing our apps.

We have come to the end of this chapter and book. We hope that you’ve enjoyed following along with the chapters and that you’re now in a position to develop Android apps with the knowledge gained from this book. What are the next steps? Here are some of the things that you can do:

  • Secure your app using the tips and tricks we went over in this chapter.
  • Inspect, improve, and monitor the performance of your app. You can learn more about this from the official documentation at https://developer.android.com/topic/performance/overview.
  • Learn more about Modern Android Development (MAD). MAD is a set of tools and libraries that help us develop Android apps faster and better. You...
lock icon The rest of the chapter is locked
You have been reading a chapter from
Mastering Kotlin for Android 14
Published in: Apr 2024 Publisher: Packt ISBN-13: 9781837631711
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}