RequestPermission: Как дождаться получения разрешения? ⇐ Android
RequestPermission: Как дождаться получения разрешения?
Android API 23 and above requires that "dangerous" permissions be confirmed at run-time. In accordance with other StackOverflow suggestions, I check for required permissions using checkSelfPermissions() and if required, call requestPermissions(). That works fine, but the request is handled asynchronously, i.e., requestPermissions() returns immediately. The problem is that my app goes on its merry way after requestPermissions(). Sometime later, the permission confirm dialog(s) appear but by that time, my app has tried API calls that fail.
I assume I need to wait until all permissions have been granted before proceeding in my app. I guess I could implement some polling kluge to do this but that's just too crude for me. What is the "Best Practice" to get around this? Various Best Practice descriptions in the documentation do not address this issue.
Источник: https://stackoverflow.com/questions/529 ... il-granted
Android API 23 and above requires that "dangerous" permissions be confirmed at run-time. In accordance with other StackOverflow suggestions, I check for required permissions using checkSelfPermissions() and if required, call requestPermissions(). That works fine, but the request is handled asynchronously, i.e., requestPermissions() returns immediately. The problem is that my app goes on its merry way after requestPermissions(). Sometime later, the permission confirm dialog(s) appear but by that time, my app has tried API calls that fail.
I assume I need to wait until all permissions have been granted before proceeding in my app. I guess I could implement some polling kluge to do this but that's just too crude for me. What is the "Best Practice" to get around this? Various Best Practice descriptions in the documentation do not address this issue.
Источник: https://stackoverflow.com/questions/529 ... il-granted
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Уведомление. Requestpermission () не подсказывает разрешение / отказ на ios safari 16.5
Anonymous » » в форуме IOS - 0 Ответы
- 17 Просмотры
-
Последнее сообщение Anonymous
-