How to use the react-native-onesignal.configure function in react-native-onesignal

To help you get started, we’ve selected a few react-native-onesignal 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 mustafaskyer / rigel-rn / App / App.js View on Github external
constructor() {
    super();
    i18n.locale = "tr"; // manually set language
    EStyleSheet.build({
      ...colors,
      ...fonts
    });

    OneSignal.init("98036549-9d8f-40fd-abdf-05fc18d89f2c");
    OneSignal.addEventListener("received", this.onReceived);
    OneSignal.addEventListener("opened", this.onOpened);
    OneSignal.addEventListener("ids", this.onIds);
    OneSignal.configure(); // triggers the ids event
  }
  componentWillUnmount() {
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
// console.log('setting idle timer disabled to true, notifications.ios.js line 49');
          IdleTimerManager.setIdleTimerDisabled(true);
        } else {
          // console.log('timer is on');
          // console.log('screen will dim');
          // console.log('setting idle timer disabled to false, notifications.ios.js line 43');
          IdleTimerManager.setIdleTimerDisabled(false);
        }
        this.dispatch(updateSilentSwitchState(silent));
      }
    });

    // Push Notifications Configure
    OneSignal.addEventListener('ids', this.onIds.bind(this));
    OneSignal.addEventListener('received', this.onPushNotificationReceived.bind(this));
    OneSignal.configure();

    // Local Notifications Configure
    NotificationsIOS.addEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.addEventListener('notificationReceivedBackground', this.onNotificationReceivedBackground.bind(this));
    NotificationsIOS.addEventListener('notificationOpened', this.onNotificationOpened.bind(this));

    this.snoozeAction = new NotificationAction({
      activationMode: 'background',
      title: 'Snooze',
      identifier: 'SNOOZE_ACTION',
    }, (action, completed) => {
      this.dispatch(snoozeAlarm(action.notification.getData().alarmUUID));
      completed();
    });

    this.stopAction = new NotificationAction({
github mhdrare / Shovee-Frontend / src / screens / Checkout.js View on Github external
constructor(props) {
        super(props);

        this.deviceID = ''

        OneSignal.init("df4cae47-cd9d-4dd5-b97f-5f63593f39fb")
        OneSignal.inFocusDisplaying(2)
        
        OneSignal.addEventListener('received', this.onReceived);
        OneSignal.addEventListener('opened', this.onOpened);
        OneSignal.addEventListener('ids', device => {
            this.deviceID = device.userId
        });
        OneSignal.configure();

        this.state = {
            checked: false,
            count: 0,
            isLoading: false,
            data: [
                {
                    id: '1',
                    seller: 'grosir.outdoor.shop',
                    description: '1 KG 1 Roll Wallpaper 10 meter X 45 cm  wallpaper dinding Motif hellokitty doraemon dll',
                    image: 'https://cf.shopee.co.id/file/webp/6e060dc67897556a6065a1e93750521d_tn',
                    price: 'Rp 25.000'
                },
                {
                    id: '2',
                    seller: 'Shopeefy',
github Weakky / prisma-ecommerce / mobile / src / views / home / Home.js View on Github external
componentWillMount() {
    OneSignal.init('22fcdd38-fb1c-43ce-8619-947d613c84d4', {
      kOSSettingsKeyAutoPrompt: true,
    });
    OneSignal.configure();

    OneSignal.addEventListener('ids', this.onIds);

    this.subscription = this.props.client
      .watchQuery({ query: commonQueries.userInformation })
      .subscribe(({ data: updatedResult }) => {
        this.setState({ cartLength: updatedResult.me.cart.length });
      });
  }
github mhdrare / Shovee-Frontend / App.js View on Github external
constructor(props) {
    super(props);
    OneSignal.init("df4cae47-cd9d-4dd5-b97f-5f63593f39fb");

    OneSignal.addEventListener('received', this.onReceived);
    OneSignal.addEventListener('opened', this.onOpened);
    OneSignal.addEventListener('ids', this.onIds);
    OneSignal.configure();
  }
  componentWillUnmount() {
github jsappme / react-native-firebase-starter / src / app.js View on Github external
componentDidMount() {
    console.log("-------xxxx------ App - componentDidMount ------xxxx-------")
    OneSignal.inFocusDisplaying(0)
    OneSignal.configure({
      onNotificationReceived: function(notification) {
        //console.log('NOTIFICATION RECEIVED: ', notification)
        if (notification.payload.additionalData.new_message && appStore.current_puid != notification.payload.additionalData.puid) {
          console.log("       appStore.new_messages + 1 : " + appStore.current_puid)
          appStore.new_messages = appStore.new_messages + 1
        }
      },
      onNotificationOpened: function(openResult) {
        console.log(openResult);
        console.log('MESSAGE: ', openResult.notification.payload.body)
        console.log('CURRENT PUID:' + appStore.current_pui)
        console.log('ISACTIVE: ', openResult.notification.isAppInFocus)
        console.log('DATA: ', openResult.notification.payload.additionalData)
        if (!openResult.notification.isAppInFocus) {
          if (openResult.notification.payload.additionalData) {
            if (appStore.current_puid != openResult.notification.payload.additionalData.puid) {