PermissionsDispatcher icon indicating copy to clipboard operation
PermissionsDispatcher copied to clipboard

onRequestPermissionsResult is deprecated

Open Dl7028 opened this issue 5 years ago • 11 comments

FAQs


Overview

  • onRequestPermissionsResult is deprecated

Expected

  • use registerForActivityResult(ActivityResultContract, ActivityResultCallback) passing in a RequestMultiplePermissions object for the ActivityResultContract and handling the result in the callback.

Actual

  • What is the actual behavior?

Environment

  • Which library version are you using?
  • On which devices do you observe the issue?
  • Note any other information that might be useful

Reproducible steps

  • While it's not required, it'd be perfect to add a link to a sample project where you encounter the issue

Dl7028 avatar Nov 25 '20 15:11 Dl7028

thx, this is something we've been thinking of.

hotchemi avatar Nov 25 '20 16:11 hotchemi

Facing the same issue. It even caused infinite recursive.

SaidAlSouti avatar Nov 28 '20 08:11 SaidAlSouti

It even caused infinite recursive.

what do you mean? I suppose it's not related to the issue 🤔

hotchemi avatar Dec 13 '20 02:12 hotchemi

Hi, do you know when the deprecated methods will be support?

JeromeCHA avatar Mar 12 '21 07:03 JeromeCHA

Facing warnings for this as well. We use Dagger version 2.33, which depends on newer Activity/Fragment APIs that deprecates onRequestPermissionsResult. Since onRequestPermissionsResult is used by permissiondispatcher generated code we are receiving warnings for this.

alvindizon avatar Mar 18 '21 07:03 alvindizon

um...I know it's deprecated but I'm afraid we can't keep the current API with ActivityResultContract 🤔 Can anyone think of it?

In my understanding, the reason Google has deprecated onRequestPermissionsResult is just to induce us to use ActivityResultContract and I haven't been able to find an imminent reason to move on to ActivityResultContract to be honest. Maybe just suppressing the warning could be a temporal solution?

hotchemi avatar Mar 25 '21 15:03 hotchemi

So we need to suppress warning in the generated PermissionDispatcher files?

JeromeCHA avatar May 12 '21 03:05 JeromeCHA

For a quick fix that can be enough, but better if you use the expected solution from Yuki-r's comment: https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/699#issue-750935141

tyborg avatar May 12 '21 06:05 tyborg

So we need to suppress warning in the generated PermissionDispatcher files?

Will you do it?

RustamSitdikov avatar May 26 '21 21:05 RustamSitdikov

@RustamSitdikov No, I don't really like to update generated code files. Instead, we have decided to remove PermissionDispatcher library and use ActivityResultContract with RequestMultiplePermissions.

JeromeCHA avatar Jun 03 '21 06:06 JeromeCHA

@hotchemi Hi, I face the same problem of gradle report onRequestPermissionsResult is deprecated, do you have timeline or quick solution to fix that? We do not want to change the generated code files.

blueiceheaven avatar Jun 06 '21 02:06 blueiceheaven