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

[Add] Android 13 notification permission prompting #326

Merged
merged 4 commits into from
Jul 30, 2022

Conversation

jkasten2
Copy link
Member

@jkasten2 jkasten2 commented Jul 29, 2022

Description

One Line Summary

Adds notification permission prompting for Android 13 devices.

Details

Motivation

Android 13 requires prompting for permission before notifications can be displayed.

Scope

Pre-existing OneSignal.PromptForPushNotificationsWithUserResponse method has the following changes:

  • Works on Android
  • Added an optional fallbackToSettings option.

Related PRs

This feature was added in the OneSignal-Android-SDK PRs OneSignal/OneSignal-Android-SDK#1607 and OneSignal/OneSignal-Android-SDK#1615.

Testing

Unit testing

None, no pre-existing infrastructure.

Manual testing

Tested with Visual Studio for Mac 2019 on the included Sample project. Tested with an Android 13 beta 3 emulator and an iOS Simulator on iOS 15.4.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
    • Prompting
  • 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
  • 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.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

This is required so the new promptForPushNotifications becomes available
for android.
PromptForPushNotificationsWithUserResponse already exists as a public
method for iOS, this comment simply adds the required code to connect
this feature to the OneSignal-Android-SDK.
Also add some output so the accept or decline value can be seen in the
log.
Added this option to both iOS and Android. The OneSignal-iOS-SDK already
had this feature but it was connected before.
@jkasten2 jkasten2 mentioned this pull request Jul 29, 2022
Copy link

@nan-li nan-li left a comment

Choose a reason for hiding this comment

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

LGTM

@jkasten2 jkasten2 merged commit 60a3d4c into main Jul 30, 2022
@jkasten2 jkasten2 deleted the add/android13_notification_permission_prompting branch July 30, 2022 22:56
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.

None yet

2 participants