Skip to content

Avoid requiring binding when checking permission state #186

@hrodrick

Description

@hrodrick

Hi, I am verifying if a user has permissions on background via an android service at startup, and I am receiving an exception that crashes the app because the app's activity is null (which is true). The problem is that the activity is expected to be null, because I am verifying permissions in background. My use case is to avoid collecting background location data if the user never gave permission.

I check permissions with this:

permissionsController.let {
    it.getPermissionState(Permission.LOCATION) != PermissionState.Granted
            || it.getPermissionState(Permission.BACKGROUND_LOCATION) != PermissionState.Granted
}

As far as i know, there shouldn´t be any need to bind the controller with an activity if we are just checking if permissions are granted (so, not prompting)

is this a bug, or am I missing something?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions