How to use the react-native-push-notification.requestPermissions function in react-native-push-notification

To help you get started, we’ve selected a few react-native-push-notification examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / react-native-push-notification / react-native-push-notification-tests.ts View on Github external
import PushNotification from 'react-native-push-notification';

PushNotification.configure({
    onNotification: (notification) => {
        notification.finish("UIBackgroundFetchResultNoData");
    },
    onRegister: (token) => {},
    senderID: 'XXX',
    popInitialNotification: false,
    requestPermissions: true,
});

PushNotification.unregister();
PushNotification.localNotification = (details) => {};
PushNotification.localNotificationSchedule = (details) => {};
PushNotification.requestPermissions();
PushNotification.presentLocalNotification = (details) => {};
PushNotification.scheduleLocalNotification = (details) => {};
PushNotification.cancelLocalNotifications = (details) => {};
PushNotification.cancelAllLocalNotifications();
PushNotification.setApplicationIconBadgeNumber(1);
PushNotification.getApplicationIconBadgeNumber((badgeCount) => {});
PushNotification.popInitialNotification((notification) => {});
PushNotification.checkPermissions((checkPermissions) => {});
PushNotification.abandonPermissions();
PushNotification.registerNotificationActions(['Accept', 'Reject', 'Yes', 'No']);
PushNotification.clearAllNotifications();
github OriginProtocol / origin / mobile / src / components / notification-card.js View on Github external
onPress={async () => {
            let permissions
            try {
              permissions = await PushNotification.requestPermissions()
            } catch (error) {
              Sentry.captureMessage(error.toString())
              props.onRequestClose()
            }

            await props.setNotificationsRequested(true)

            if (permissions && permissions.alert) {
              props.onRequestClose()
            }
          }}
        />
github keybase / client / shared / actions / platform-specific.native.js View on Github external
function requestPushPermissions(): Promise<*> {
  return isIOS ? PushNotifications.requestPermissions() : Promise.resolve()
}
github crownstone / CrownstoneApp / js / backgroundProcesses / NotificationHandler.ts View on Github external
request() {
    if (this.requesting === false) {
      LOGi.notifications("NotificationHandler: Requesting push permissions");
      this.requesting = true;
      PushNotification.requestPermissions();
    }
    else {
      LOGi.notifications("NotificationHandler: Push permissions request already pending.");
    }
  }
}
github keybase / client / shared / actions / platform-specific.native.js View on Github external
function requestPushPermissions() {
  return isIOS ? PushNotifications.requestPermissions() : Promise.resolve()
}
github textileio / photos / App / Services / Notifications.ts View on Github external
return new Promise((resolve, reject) => {
    try {
      RNPushNotification.requestPermissions()
      resolve()
    } catch (error) {
      reject(error)
    }
  })
}
github fbsamples / f8app / js / PushNotificationsController.js View on Github external
componentDidUpdate(prevProps) {
    if (!prevProps.enabled && this.props.enabled) {
      PushNotification.requestPermissions();
    }
    if (this.props.badge !== prevProps.badge) {
      this.updateAppBadge();
    }
    if (this.props.tab === "info" && prevProps.tab !== "info") {
      this.eventuallyMarkNotificationsAsSeen();
    }
  }
github LiskHQ / lisk-mobile / src / utilities / notifications.js View on Github external
PushNotification.checkPermissions(({ alert, badge, sound }) => {
      if (!alert || !badge || !sound) {
        PushNotification.requestPermissions()
          .then((target) => {
            if (target.alert || target.badge || target.sound) {
              resolve();
            } else {
              reject();
            }
          });
      } else {
        resolve();
      }
    });
  } else {