Avatar ·

How to programmatically open Android settings from an app?

Hello everyone! I'm a beginner Android developer in Kotlin, and I've encountered a task: I need to add a button to the app that opens system Android settings (e.g., Wi-Fi settings, Bluetooth, or general app settings). I tried using an Intent with the action Settings.ACTION_SETTINGS, but the app just crashes with an error. Here's my code: ```kotlin val intent = Intent(Settings.ACTION_SETTINGS) startActivity(intent) ``` I'm getting an `ActivityNotFoundException`. I read the documentation, and it says I need to add some flags? Or maybe I need to specify a package? I'm confused because I've heard it worked on older versions of Android, but on my emulator with Android 12 it doesn't. Please advise on how to correctly open settings. Do I need to request per