Having followed the migration notes and added the following line to the manifest :
I could not figure out why I am getting a failing test case where the permission
android.permission.FOREGROUND_SERVICE is not being granted (at least when it's being checked on run-time).
Based on the docs, which states that
android.permission.FOREGROUND_SERVICEshould be automatically granted by the system.
apps wanting to use foreground services must now request the FOREGROUND_SERVICE permission first. This is a normal permission, so the system automatically grants it to the requesting app.
Can somebody explain why test case (which uses a variant of the the following code) is failing?
assert (ActivityCompat.checkSelfPermission(activity, "android.permission.FOREGROUND_SERVICE") == PackageManager.PERMISSION_GRANTED)
Yet! I am not having any
SecurityException thrown. Which makes me doubt about the way I should check permissions on run-time.
What am I missing?