React Native Firebase Silent notification handler takes a log time

29 Views Asked by At

I've integrated react-native-firebase into my app to manage silent background notifications. However, I'm encountering an issue. When the application is in a killed state, I send a notification, and although the app displays the log instantly "Bundle" in development mode, it takes approximately 8 seconds to log the first time, even in a production apk. Subsequent notifications, without opening the app, are displayed instantly.

Is this delay in logging expected behavior? I've attempted to reproduce the issue in a native environment, where notifications appear instantly every time.

I appreciate any insights or suggestions to improve this situation.

/**
 * @format
 */

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import messaging from '@react-native-firebase/messaging';
import {Platform} from 'react-native';
import './src/Localization/i18n';


messaging().setBackgroundMessageHandler(async remoteMessage => {
    console.log('Background Notification');
}); AppRegistry.registerComponent(appName, () => App);

    public void onMessageReceived(RemoteMessage remoteMessage) {
        Log.d(TAG, "Silent push notification received.");

        // Extract the call information from the notification

        // Create a PendingIntent for the notification click action
    
    }
0

There are 0 best solutions below