Avatar ·

How to launch an Activity from another app in Android on Kotlin

Hello everyone! I'm a beginner Android developer in Kotlin, and I have a problem. I need my app to launch some other app on the device, for example, the camera, maps, or a third-party messenger. I've read about Intent, but I don't fully understand how to do it correctly.\n\nI tried writing this code, but it doesn't work — the app just crashes or nothing happens:\n\n```kotlin\nval intent = Intent()\nintent.action = Intent.ACTION_VIEW\nintent.data = Uri.parse("package:com.example.targetapp")\nstartActivity(intent)\n```\n\nI know that to launch another app you need to know its package name, but how do I get it? And what to do if the app is not installed? I've also heard about explicit and implicit intents — what's the difference?\n\nI need a detailed explanation: how to find