Reputation: 499
In my application, I want the user to tap a button to open the app info in the settings. This button is inside a Fragment.
If I press the button, the application crashes, throwing
ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.APPLICATION_DETAILS_SETTINGS dat=com.meltixdev.revomusicplayer }
The weird thing is that when I try to open ACTION_APPLICATION_SETTINGS
instead, the app opens the settings as it should.
This is what I did to start the Settings:
binding.btnPermission.setOnClickListener {
startActivity(Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("com.meltixdev.revomusicplayer")))
}
What am I doing wrong? Is there something I am missing?
Upvotes: 0
Views: 464
Reputation: 411
You should add package:
before your package name like below
binding.btnPermission.setOnClickListener {
startActivity(Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:com.meltixdev.revomusicplayer")))
}
Upvotes: 4