How to use the react-native-onesignal.addEventListener 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 wendelfreitas / animavita / mobile / src / index.js View on Github external
useEffect(() => {
    getData();
    OneSignal.init(ONE_SIGNAL_APP_KEY);
    OneSignal.addEventListener('received', onReceived);
    OneSignal.addEventListener('opened', onOpened);
    OneSignal.addEventListener('ids', onIds);
    return () => {
      OneSignal.removeEventListener('received', this.onReceived);
      OneSignal.removeEventListener('opened', this.onOpened);
      OneSignal.removeEventListener('ids', this.onIds);
    };
  }, []);
github wendelfreitas / animavita / mobile / src / index.js View on Github external
useEffect(() => {
    getData();
    OneSignal.init(ONE_SIGNAL_APP_KEY);
    OneSignal.addEventListener('received', onReceived);
    OneSignal.addEventListener('opened', onOpened);
    OneSignal.addEventListener('ids', onIds);
    return () => {
      OneSignal.removeEventListener('received', this.onReceived);
      OneSignal.removeEventListener('opened', this.onOpened);
      OneSignal.removeEventListener('ids', this.onIds);
    };
  }, []);
github StoDevX / AAO-React-Native / source / app.js View on Github external
componentDidMount() {
		OneSignal.init(ONESIGNAL_APP_ID, {kOSSettingsKeyAutoPrompt: false})

		OneSignal.addEventListener('received', this.onReceived)
		OneSignal.addEventListener('opened', this.onOpened)
		OneSignal.addEventListener('ids', this.onIds)
	}
github egm0121 / splitcloud-app / index.ios.js View on Github external
bindNotificationListeners(){
    OneSignal.addEventListener('received', (notification) => {
      console.log('received notification!', notification);
      return false;
    });
    OneSignal.addEventListener('ids',(device) => {
      console.log('received device info: ', device);
    });
    OneSignal.addEventListener('opened', (opened) => {
      console.log('Opened notification', opened);
      const notificationData = opened.notification.payload.additionalData;
      if( this.navigator ){
        this.handlePushNotification(notificationData);
      } else {
        this.initialNotification = notificationData;
      }
    });
  }
github StoDevX / AAO-React-Native / source / app.js View on Github external
componentDidMount() {
		OneSignal.init(ONESIGNAL_APP_ID, {kOSSettingsKeyAutoPrompt: false})

		OneSignal.addEventListener('received', this.onReceived)
		OneSignal.addEventListener('opened', this.onOpened)
		OneSignal.addEventListener('ids', this.onIds)
	}
github egm0121 / splitcloud-app / index.ios.js View on Github external
bindNotificationListeners(){
    OneSignal.addEventListener('received', (notification) => {
      console.log('received notification!', notification);
      return false;
    });
    OneSignal.addEventListener('ids',(device) => {
      console.log('received device info: ', device);
    });
    OneSignal.addEventListener('opened', (opened) => {
      console.log('Opened notification', opened);
      const notificationData = opened.notification.payload.additionalData;
      if( this.navigator ){
        this.handlePushNotification(notificationData);
      } else {
        this.initialNotification = notificationData;
      }
    });
  }
  handlePushNotification(notification){
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',
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'
github hummingbird-me / kitsu-mobile / src / App.js View on Github external
componentWillMount() {
    OneSignal.inFocusDisplaying(2);
    OneSignal.addEventListener('ids', this.onIds);
    OneSignal.addEventListener('registered', this.onPNRegistered);
    OneSignal.addEventListener('received', this.onReceived);
    OneSignal.addEventListener('opened', this.onOpened);
    this.unsubscribe = store.subscribe(this.onStoreUpdate);
    this.unsubscribeCreate = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_CREATE, this.onLibraryEntryCreated);
    this.unsubscribeUpdate = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_UPDATE, this.onLibraryEntryUpdated);
    this.unsubscribeDelete = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_DELETE, this.onLibraryEntryDeleted);
  }