android
ShortCut 관련 기능 실행시 - Caller can't access shortcut information 에러
seoft
2019. 9. 27. 21:46
[문제정의]
ShortCut 리스트 load 후 실행 할 로직을 위해 해당 코드 실행시
val launcherApps : LauncherApps by lazy { App.get.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps } launcherApps.getShortcuts(shortcutQuery,Process.myUserHandle()) |
다음 에러 발생
Caller can't access shortcut information |
hasShortcutHostPermission() 호출시 false로 반환되는 상태
[문제해결]
manifest를 홈런처로 지정해야만 사용이 가능
<activity android:name=".ui.main.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.HOME"/> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> |
또한 Default Home Launcher로 지정이 안된 상태면 권한이 없어 에러가 야기됨