Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission callbacks not working (kotlin) #31

Open
stevep99 opened this issue Feb 10, 2018 · 1 comment
Open

Permission callbacks not working (kotlin) #31

stevep99 opened this issue Feb 10, 2018 · 1 comment

Comments

@stevep99
Copy link

stevep99 commented Feb 10, 2018

Using this pretty simple kotlin code:

    Ask.on(this)
            .id(1001)
            .forPermissions(Manifest.permission.ACCESS_FINE_LOCATION)
            .withRationales(getString(R.string.location_permission_rationale))
            .go()

    @AskGranted(Manifest.permission.ACCESS_FINE_LOCATION)
    fun mapAccessGranted(id: Int) {
      ...
    }

When running the app, permission is asked, but after OKing, mapAccessGranted is never called.

I have debugged the app and have found that, Ask.getAnnotatedMethod() gets called and seems to find the callback method OK, adding it to permissionMethodMapRef. So far so good.

However, when Ask.invokeMethod() is called, permissionMethodMapRef.get() is null, throwing the Exception at line 229.

Seems the WeakReference has been destroyed in the meantime.

Is this a kotlin specific issue? Any suggested workaround?

@ghost
Copy link

ghost commented Jul 10, 2018

Having the same issue, but with Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant