Skip to content

Add canRequestPermission to Android#1570

Merged
nan-li merged 1 commit into
major_release_5.0.0from
fix/android_can_request_permission
Sep 27, 2023
Merged

Add canRequestPermission to Android#1570
nan-li merged 1 commit into
major_release_5.0.0from
fix/android_can_request_permission

Conversation

@nan-li

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

Copy link
Copy Markdown
Contributor

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
@nan-li nan-li mentioned this pull request Sep 27, 2023
@fadi-george fadi-george deleted the fix/android_can_request_permission branch May 23, 2026 18:49
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