Skip to content

Commit c92391e

Browse files
committed
bridge: add requestNotificationAuthorization implementation for android
1 parent d39508c commit c92391e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

android/src/main/java/com/batch/batch_rn/RNBatchModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ public void push_getLastKnownPushToken(Promise promise) {
239239
promise.resolve(pushToken);
240240
}
241241

242+
@ReactMethod
243+
public void push_requestNotificationAuthorization() {
244+
Batch.Push.requestNotificationPermission(reactContext);
245+
}
246+
242247
// MESSAGING MODULE
243248

244249
private void showPendingMessage() {

src/BatchPush.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,12 @@ export const BatchPush = {
4040
},
4141

4242
/**
43-
* Ask iOS users if they want to accept push notifications.
44-
* Required to be able to push users (or use requestProvisionalNotificationAuthorization).
43+
* Ask users if they want to accept push notifications.
44+
* Required to be able to push users (or use requestProvisionalNotificationAuthorization - ios only).
4545
*
46-
* No effect on Android.
4746
*/
4847
requestNotificationAuthorization: (): void => {
49-
if (Platform.OS === 'ios') {
50-
RNBatch.push_requestNotificationAuthorization();
51-
}
48+
RNBatch.push_requestNotificationAuthorization();
5249
},
5350

5451
/**

0 commit comments

Comments
 (0)