voximplant/react-native-foreground-service

null is not an object (evaluating 'ForegroundServiceModule.createNotificationChannel

Temirtator opened this issue · 1 comments

Error happens when creating notification channel

useEffect(() => {
    const channelConfig = {
      id: 'channelId',
      name: 'Channel name',
      description: 'Channel description',
      enableVibration: false,
    };
    VIForegroundService.createNotificationChannel(channelConfig);

    startWatchPosition();
    _init();
  }, [_init]);

I was having the same issue.
The VIForegroundService was not showing up in NativeModules.

Doing a simple
rm -rf node_modules && yarn
was not enough

I had to clear my android build folder too
cd android/app && rm -rf build