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

Notification runtime permission #315

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sivasubramaniamv
Copy link
Contributor

@sivasubramaniamv sivasubramaniamv commented Jun 1, 2023

Fixes #251

Tested on Realme Narzo 30 5G running Android 13

@sivasubramaniamv
Copy link
Contributor Author

@fm-sys I've done basic permission handling and skipped redirecting the user to the app settings after permission has been denied twice(as the user may find it annoying to see a snackbar every time they open the app).

Please take a look and let me know if any changes/improvements are to be made.

@fm-sys
Copy link
Owner

fm-sys commented Jun 1, 2023

Hm, I somehow don't really like it if apps randomly ask for a permission. Two options come to my mind (the second would be the way to go IMHO):

  • Add another page to the "onboarding guide" explaining why this permission is necessary and ask for it

    • downside:
      • onboarding gets even longer
      • we would have to show a reduced "upgrade" onboarding to all existing users
  • Show an alert dialog asking whether the user wants to receive notifications about completed downloads

    • it should IMHO be shown as soon as the first download is complete
    • users (hopefully) understand why this permission is necessary and are able to choose

Or another variant (similar to no. 2):

  • directly ask for the permission as soon as the first download is complete, and show the alert dialog only if permission gets denied

What do you think?

@sivasubramaniamv
Copy link
Contributor Author

sivasubramaniamv commented Jun 2, 2023

  • directly ask for the permission as soon as the first download is complete, and show the alert dialog only if permission gets denied

I think this is the appropriate way.

I have a few questions:

"Show the alert dialog only if permission gets denied" - do you want the alert dialog to be shown when shouldShowRequestPermissionRationale() returns true or as soon as the user denies the permission for the first time?

"As soon as the first download is complete" - after the first file transfer is complete or after the first file is downloaded?

@fm-sys
Copy link
Owner

fm-sys commented Jun 2, 2023

"Show the alert dialog only if permission gets denied" - do you want the alert dialog to be shown when shouldShowRequestPermissionRationale() returns true or as soon as the user denies the permission for the first time?

Both options would make sense and are probably pretty equivalent. Or did I missed something?

"As soon as the first download is complete" - after the first file transfer is complete or after the first file is downloaded?

As soon as we try to show the first notification, I guess.

directly ask for the permission as soon as the first download is complete, and show the alert dialog only if permission gets denied

I think this is the appropriate way

OTOH really popular apps like WhatsApp or Signal messager also show the Explanation Dialog before requesting the permission for the first time. IMHO there are good reasons for it...

@sivasubramaniamv
Copy link
Contributor Author

Both options would make sense and are probably pretty equivalent. Or did I miss something?

If we implement permission handling as suggested in the official Android documentation,

  1. Showing the alert dialog when the user denies permission (in the permission launcher result callback) will cause the dialog to be shown as soon as the user presses "don't allow".
  2. Showing the alert dialog when shouldShowRequestPermissionRationale() returns true will show the dialog only when the action is performed again (ie: In this case, the action is making a file transfer).

As soon as we try to show the first notification, I guess.

A notification is created for every successfully downloaded file.

If we should show the dialog as soon as we try to show the first notification, we'd have to put it in a method that is called when the file-received event is fired, which would spawn multiple alert dialogs.

OTOH really popular apps like WhatsApp or Signal messager also show the Explanation Dialog before requesting the permission for the first time. IMHO there are good reasons for it.

Sounds reasonable.

Copy link

@KATHLOY-0709 KATHLOY-0709 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help me to use

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

Successfully merging this pull request may close these issues.

Re-enable notifications on Android 13+
3 participants