티스토리 뷰
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.
How can I programmatically open the permission screen for a specific app on Android 6.0 (Marshmallow)?
Android 6.0(Marshmallow)에서 특정 앱의 권한 화면을 프로그래밍 방식으로 열려면 어떻게 해야 합니까?
문제 내용
I have a question regarding the new Android 6.0 (Marshmallow) release.
새로운 Android 6.0(Marshmallow) 릴리스와 관련하여 질문이 있습니다.
Is it possible to display the "App Permissions" screen for a specific app via an Intent or something similar?
특정 앱의 "앱 권한" 화면을 인텐트 또는 유사한 방법으로 표시할 수 있을까요?
It is possible to display the app's "App Info" screen in Settings with the following code:
다음 코드를 사용하여 앱의 "앱 정보" 화면을 설정에서 표시할 수 있습니다:
startActivity(
new Intent(
android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null)
)
);
Is there an analogous solution for directly opening the app's "App Permissions" screen?
앱의 "앱 권한" 화면을 직접 열 수 있는 유사한 솔루션이 있나요?
I already did some research on this but I was not able to find a solution.
이미 이 문제에 대해 약간의 조사를 진행했지만, 해결책을 찾지 못했습니다.
높은 점수를 받은 Solution
According to the official Marshmallow permissions video (at the 4m 43s mark), you must open the application Settings page instead (from there it is one click to the Permissions page).
공식 Marshmallow 권한 비디오에 따르면 (4분 43초), 권한 페이지로 이동하려면 대신 애플리케이션 설정 페이지를 열어야합니다 (거기에서 권한 페이지로 이동하는 것은 한 번의 클릭이면 됩니다).
To open the settings page, you would do
설정 페이지를 열려면, 다음과 같이 할 수 있습니다.
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);
가장 최근 달린 Solution
In Kotlin
Kotlin에서는 다음과 같습니다.
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri: Uri = Uri.fromParts("package", packageName, null)
intent.data = uri
// This will take the user to a page where they have to click twice to drill down to grant the permission
startActivity(intent)
Above one is tested and working code, hope it will help.
위에 있는 코드는 테스트되고 작동하는 코드입니다. 도움이 되었으면 좋겠습니다.
출처 : https://stackoverflow.com/questions/32822101/how-can-i-programmatically-open-the-permission-screen-for-a-specific-app-on-andr
'개발 > 안드로이드' 카테고리의 다른 글
웹뷰에 pdf 문서 불러오기 (0) | 2022.12.22 |
---|---|
Manifest Merger failed 오류 수정하기 (0) | 2022.12.22 |
AndroidViewModel과 ViewModel의 차이점 (0) | 2022.12.21 |
Android: 이전 액티비티로 돌아가기 (0) | 2022.12.21 |
'package R does not exist' 오류 수정하기 (0) | 2022.12.21 |