android-components / / PermissionsFeature


interface PermissionsFeature (source)

Interface for features that need to request permissions from the user.

Example integration:

class MyFragment : Fragment {
    val myFeature = MyPermissionsFeature(
        onNeedToRequestPermissions = { permissions ->
            requestPermissions(permissions, REQUEST_CODE_MY_FEATURE)

    override fun onRequestPermissionsResult(resultCode: Int, permissions: Array<String>, grantResults: IntArray) {
        if (resultCode == REQUEST_CODE_MY_FEATURE) {
            myFeature.onPermissionsResult(permissions, grantResults)

    companion object {
        private const val REQUEST_CODE_MY_FEATURE = 1


Name Summary
onNeedToRequestPermissions abstract val onNeedToRequestPermissions: OnNeedToRequestPermissions
A callback invoked when permissions need to be requested by the feature before it can complete its task. Once the request is completed, onPermissionsResult needs to be invoked.


Name Summary
onPermissionsResult abstract fun onPermissionsResult(permissions: Array<String>, grantResults: IntArray): Unit
Notifies the feature that a permission request was completed. The feature should react to this and complete its task.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.


Name Summary
DownloadsFeature class DownloadsFeature : LifecycleAwareFeature, PermissionsFeature
Feature implementation to provide download functionality for the selected session. The feature will subscribe to the selected session and listen for downloads.
P2PFeature class P2PFeature : SelectionAwareSessionObserver, LifecycleAwareFeature, PermissionsFeature
Feature implementation for peer-to-peer communication between browsers.
PromptFeature class PromptFeature : LifecycleAwareFeature, PermissionsFeature, Prompter
Feature for displaying native dialogs for html elements like: input type date, file, time, color, option, menu, authentication, confirmation and alerts.
QrFeature class QrFeature : LifecycleAwareFeature, UserInteractionHandler, PermissionsFeature
Feature implementation that provides QR scanning functionality via the QrFragment.
SitePermissionsFeature class SitePermissionsFeature : LifecycleAwareFeature, PermissionsFeature
This feature will subscribe to the currently selected Session and display a suitable dialogs based on Session.Observer.onAppPermissionRequested or Session.Observer.onContentPermissionRequested events. Once the dialog is closed the PermissionRequest will be consumed.