I am trying to conform to the new Android 14 behavioural changes, specifically the changes regarding secure full-screen intent's
The documentation is quite specific, still I am having quite some trouble to implement what is being described :
You can use the new API NotificationManager.canUseFullScreenIntent to check if your app has the permission; if not, your app can use the new intent ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT to launch the settings page where users can grant the permission.
I am testing on a Pixel 7 enrolled into the Android 14 Beta program and running the Beta 3.
So I am actually trying to do this like this
val nmgr = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (!nmgr.canUseFullScreenIntent())
{
debug(TAG,"Running Android 14 AND no permission for using full screen intent, show settings page")
startActivity(Intent(Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT))
}
Unfortunately this results in the following error :
java.lang.RuntimeException: Unable to resume activity {MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT }
I am wondering if anyone has been testing this new change within the Android 14 Beta ?
---Update--- For now I kinda solved it like this :
startActivity(Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
.addFlags(FLAG_ACTIVITY_NEW_TASK))