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 canRequestPermission to Android #1570

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Sep 27, 2023

Description

One Line Summary

OneSignal.Notifications.canRequestPermission() has been fixed for Android in OneSignal/OneSignal-Android-SDK#1798, make it available in React Native SDK.

Details

Motivation

Add OneSignal.Notifications.canRequestPermission() functionality to Android. It was previously iOS-only, with Android always returning true.

Scope

Adds OneSignal.Notifications.canRequestPermission() functionality to Android.

Note that the method OneSignal.Notifications.canRequestPermission() returns whether or not the device has been prompted for push already, and may not indicate on Android whether or not a push prompt will display.

Prior, we didn't document this method as iOS-only.

Testing

Manual testing

Testing on Android emulator API 33:

  1. New app install and see canRequestPermission = true
  2. Prompt for push and accept
  3. See canRequestPermission = false which is correct

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes = sort of, as we never documented that it was iOS-only.

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

* canRequestPermission for notifications has been fixed for Android, make it available in React Native SDK
@nan-li nan-li merged commit 651399f into major_release_5.0.0 Sep 27, 2023
2 checks passed
@nan-li nan-li mentioned this pull request Sep 27, 2023
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.

2 participants