Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AppActionsApplication : Application() {
- override fun onCreate() {
- super.onCreate()
- grantSlicePermissions()
- }
- private fun grantSlicePermissions() {
- val sliceProviderUri = Uri.Builder().apply {
- scheme(ContentResolver.SCHEME_CONTENT)
- authority(applicationContext.packageName)
- }.build()
- val assistantPackage = applicationContext.packageManager.queryIntentServices(
- Intent(VoiceInteractionService.SERVICE_INTERFACE), 0
- )?.let { it[0].serviceInfo.packageName } ?: return
- SliceManager.getInstance(applicationContext).grantSlicePermission(assistantPackage, sliceProviderUri)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement