You may want to enable the Embrace SDK on only certain builds (production), or send different data to different dashboard instances (think prod vs. dev). To separate production data vs. development or staging data, we recommend creating a new platform with a new app key and sending data to separate keys. For only enabling Embrace on specific builds, see the following for iOS vs. Android:
On iOS:
- On iOS our SDK is enabled by calling a variant of "[[Embrace sharedInstance] startWithKey:@"API_KEY"];
- To enable it in only certain build configurations (debug vs release for example), we just have to call or not call that method conditionally. In Xcode we can add a flag for this under the target's build settings -> Preprocessor Macros.
- In that setting you'll see all the existing build configurations. If you pick one you can add custom preprocessor defines. For this let's add "USE_EMBRACE=1" under the "Debug" configuration and "USE_EMBRACE=0" under the "Release" configuration.
- Now, going back to the place in the code where we start the embrace SDK we can now wrap that call to check our new preprocessor flag: "#if USE_EMBRACE
- [[Embrace sharedInstance] startWithKey:@"API_KEY"];
- #endif"
- You can verify it is working by switching the run configuration of the app between debug and release. Xcode will ignore anything inside the USE_EMBRACE block while in release mode.
On Android: