java.lang.IllegalStateException: RealRxPermission.onRequestPermissionsResult invoked but didn't find the corresponding permission request.
See original GitHub issueOn some phones when requesting the WRITE_EXTERNAL_STORAGE permission i am getting:
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {io.soulpicks.android.beta/com.vanniktech.rxpermission.ShadowActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=42, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {io.soulpicks.android.beta/com.vanniktech.rxpermission.ShadowActivity}: java.lang.IllegalStateException: RealRxPermission.onRequestPermissionsResult invoked but didn't find the corresponding permission request.
at android.app.ActivityThread.performResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
at android.app.ActivityThread.access$900(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
This is what I use to call it:
permissionManager.request(WRITE_EXTERNAL_STORAGE)
.subscribeOn(schedulerProvider.newThread())
.observeOn(schedulerProvider.ui())
.subscribeBy(onSuccess = {
permissionRequest.value = it
},
onError = {
permissionRequest.value = Permission.denied(WRITE_EXTERNAL_STORAGE)
})
.addTo(disposables)
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (14 by maintainers)
Top Results From Across the Web
permissions - Android java.lang.IllegalStateException in ...
This Error is because the Activity State is Not Saved and you are ... to set a boolean flag in onRequestPermissionsResult and use...
Read more >com.vanniktech.rxpermission.Permission.granted java code ...
... null) { throw new IllegalStateException("RealRxPermission.onRequestPermissionsResult invoked but didn't find the corresponding permission request.
Read more >Android Runtime Permissions Example - DigitalOcean
Example : Let's say we want to access the camera and location in our app. Both are dangerous permissions. We'll display a prompt...
Read more >How to Request Permissions in Android Application?
Step 4: Override onRequestPermissionsResult() method: onRequestPermissionsResult() is called when user grant or decline the permission.
Read more >Confluence- java.lang.IllegalStateException: Sprin...
xml file and start confluence. Error Encountered Initially: HTTP Status 500 - java.lang.IllegalStateException: Spring Application context has ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, fine with me! 🙌
I think it’s not even an issue of ShadowActivity vs. retained fragment. Using a cold Observable that triggers the permission request on subscribe and emits the result is, in my opinion, not the right abstraction. Permission results are a hot observable, since they can be emitted “before” the request.
It works for the request-in-
onCreate
case, but maybe the sample should be updated with that in mind.Sure, I can have a look! Not sure when I’ll have time yet, hopefully soon.
On Thu, Nov 22, 2018 at 11:43 AM Niklas Baudy notifications@github.com wrote:
– Hannes Struß
Freelance Android Engineer @hannesstruss https://twitter.com/hannesstruss