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

[Fix] Request permission for notifications on Android when permission is true #716

Closed
wants to merge 2 commits into from

Conversation

shepherd-l
Copy link
Contributor

@shepherd-l shepherd-l commented Apr 8, 2024

Description

One Line Summary

Resolves notification request permission on Android when notification permission is true.

Details

Motivation

Calling OneSignal.Notificaitons.RequestPermissionAsync() on Android does not return when notification permission is true and awaits forever.

Scope

Issue on wrappers that use Java bridge code. A check has to be added whereas on the native Android SDK, Kotlin resolves this automatically.

Testing

Manual testing

Tested OneSignal.Notificaitons.RequestPermissionAsync() returns true when notification permission is granted, app build with Unity 2021.3.10f1 of the OneSignal example App on a Pixel 6 with Android 13.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

Request permission on Android did not return when notification permission is true. Due to the bridge being in Java, we have to add a check where as on the native SDK, Kotlin automatically resolves this.
@jkasten2
Copy link
Member

jkasten2 commented Apr 8, 2024

This sounds like a bug with our OneSignal-Android-SDK that should be fixed instead, so we don't have to work around it in all our wrapper SDKs.

Can you reproduce the continuation not firing when using the OneSignal-Android-SDK with Java code in a native Android app?

@shepherd-l
Copy link
Contributor Author

shepherd-l commented Apr 8, 2024

I may have been butchered the explanation but I talked about it with @nan-li here: OneSignal/OneSignal-Flutter-SDK#806 (comment)

I can try to reproduce it though

@shepherd-l shepherd-l requested a review from nan-li April 8, 2024 22:14
@shepherd-l
Copy link
Contributor Author

Closing due to work on fixing this in the OneSignal Android SDK instead

@shepherd-l shepherd-l closed this Apr 10, 2024
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.

3 participants