SHARE
TWEET

Untitled

a guest Oct 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class AppActionsApplication : Application() {
  2.  
  3.     override fun onCreate() {
  4.         super.onCreate()
  5.         grantSlicePermissions()
  6.     }
  7.  
  8.     private fun grantSlicePermissions() {
  9.         val sliceProviderUri = Uri.Builder().apply {
  10.             scheme(ContentResolver.SCHEME_CONTENT)
  11.             authority(applicationContext.packageName)
  12.         }.build()
  13.  
  14.         val assistantPackage = applicationContext.packageManager.queryIntentServices(
  15.             Intent(VoiceInteractionService.SERVICE_INTERFACE), 0
  16.         )?.let { it[0].serviceInfo.packageName } ?: return
  17.  
  18.         SliceManager.getInstance(applicationContext).grantSlicePermission(assistantPackage, sliceProviderUri)
  19.     }
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top