How to initialize SDK and auto-log installs only for production env

31 Views Asked by At

It seems to initialize SDK automatically on Android by default, but I don't wanna initialize SDK and send any events from development build. So what I tried is, setting the isAutoInitEnabled false in app.json and then do it in index.js. but it seems like not working as expected. I'd appreciate if anyone knows what I'm doing wrong and how to do that. Thanks!!

app.json

      [
        "react-native-fbsdk-next",
        {
          "appID": "xxx",
          "clientToken": "xxx",
          "displayName": "xxx",
          "scheme": "xxx",
          "advertiserIDCollectionEnabled": true,
          "autoLogAppEventsEnabled": true,
          "isAutoInitEnabled": false,
        }
      ]

index.js

import { registerRootComponent } from 'expo';
import { Settings as FB_SDK } from 'react-native-fbsdk-next';
import { isDev } from '@config/env';
import App from './App';

if (!isDev) {
  FB_SDK.initializeSDK();
}

registerRootComponent(App);

0

There are 0 best solutions below