Rapsssito / react-native-background-actions

React Native background service library for running background tasks forever in Android & iOS.
MIT License
819 stars 117 forks source link

Notification banner does not appear on React Native 0.68.5 #167

Closed mikgross closed 1 year ago

mikgross commented 1 year ago

Our previous implementation this worked as intended, however after updating our RN version, the banner stoped showing (the service still works):


const listeningOrdersTaskOptions = {
  taskName: 'order_listener',
  taskTitle: 'Order listener',
  taskDesc: 'We are listening on new orders in the background',
  taskIcon: {
    name: 'ic_launcher',
    type: 'mipmap',
  },
  color: '#ff00ff',
  linkingURI: '', // See Deep Linking for more info
};

const listenOrders = React.useCallback(async () => {
    try {
        // service stuff, works fine
    } catch (error) {
      console.log(error);
    }
  }, []);

  const orderSub = React.useCallback(async () => {
    await BackgroundService.start(listenOrders, listeningOrdersTaskOptions);
  }, [listenOrders]);

  React.useEffect(() => {
    orderSub();
  }, [orderSub, volumeLevel, isOffline, getOrders]);

Any idea why?

ZohaibAhmad786 commented 1 year ago

same on "react": "18.2.0", "react-native": "0.71.1",

kyungjoon1 commented 1 year ago

@Rapsssito Is there any solution to this?

Rapsssito commented 1 year ago

Solution found by @kyungjoon1 in #175.