How to enable logging - infobip/mobile-messaging-react-native-plugin GitHub Wiki

To enable platform native SDK logging in the React Native JS console, set the logging: true parameter in the initialization configuration. This feature is available for both iOS and Android platforms.

Configuration

Add the logging parameter at the root level of your configuration object:

mobileMessaging.init(
    {
        applicationCode: '<Your Application Code>',
        logging: true,
        ios: {
            notificationTypes: ['alert', 'badge', 'sound'],
        },
        android: {
            // Android specific configuration
        },
        ...
    },
    () => {
        console.log('MobileMessaging started');
    },
    (error) => {
        console.error('MobileMessaging error: ' + error);
    },
);

See the complete example in the Example App.

How it works

When logging is enabled:

  • Native SDK logs from both iOS and Android are automatically forwarded to the React Native JS console
  • Platform native error logs are displayed using console.error()
  • Platform native warning logs are displayed using console.warn()
  • Platform native info, debug, and verbose logs are displayed using console.log()

Platform-specific behavior

iOS

  • Logs appear in both Xcode console and React Native JS console when logging is enabled

Android

  • When enabled, logs appear in React Native JS console, otherwise you can find logs in Android Logcat