Oke Uwechue
Oke Uwechue

Reputation: 33

Android (OS6) runtime permissions callback thread for "onRequestPermissionsResult"

The Android OS 6 runtime permission model requires implementation of the callback method "onRequestPermissionsResult(....)" in the activity.

1) does the OS always initiate this callback on the UI thread?

2) Is it possible to programmatically select the thread on which the callback will occur (e.g. some dynamically generated background thread) ?

Can anyone shed some light on this? Thnx.

Upvotes: 1

Views: 900

Answers (2)

Chris K.
Chris K.

Reputation: 258

This must be done on the UI thread, which is one of course. Background threads can be multiple and they're used for tasks that don't block the UI. The purpose of runtime permissions is exactly that. To block the UI and wait user's action.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006944

does the OS always initiate this callback on the UI thread?

Yes.

Is it possible to programmatically select the thread on which the callback will occur (e.g. some dynamically generated background thread) ?'

No, though you are welcome to do something in onRequestPermissionResult() to affect a background thread (e.g., event bus event, post a job on executor's work queue).

Upvotes: 1

Related Questions