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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions OneSignalExample/Assets/OneSignal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Resolves Android OneSignal.Notificaitons.RequestPermissionAsync() awaiting forever when notifications permission is true.

## [5.1.1]
### Changed
- Updated included Android SDK to [5.1.6](https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/5.1.6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public NotificationPermission PermissionNative {
}

public async Task<bool> RequestPermissionAsync(bool fallbackToSettings) {
// if permission already exists, return early as the method call will not resolve
if (_notifications.Call<bool>("getPermission")) {
return true;
}

var continuation = new BoolContinuation();
_notifications.Call<AndroidJavaObject>("requestPermission", fallbackToSettings, continuation.Proxy);
return await continuation;
Expand Down
Loading