- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
By default, the React Native SDK initializes the native SDK when calling DdSdkReactNative.initialize(config)
on the JS layer, or using the DatadogProvider
. As a result, the SDK does not capture native crashes that occur prior to the initialization being called on the JS layer. Starting from v2.3.0, you can initialize your native SDK in order for Datadog to capture any crashes before the React Native layer starts.
To initialize your native SDK before React Native has started:
Create a datadog-configuration.json
file at the root of the react-native
project with the following structure:
{
"$schema": "./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json",
"configuration": {
}
}
The "$schema"
attribute here enables autocomplete and helps most modern Integrated Development Environments (IDE) to show errors if the configuration is incomplete or invalid.
Follow the steps below for your native OS.
Add the following snippet to the MainApplication.kt
file:
import com.datadog.reactnative.DdSdkNativeInitialization
class MainApplication : Application(), ReactApplication {
override fun onCreate() {
super.onCreate()
DdSdkNativeInitialization.initFromNative(this.applicationContext)
// Rest of the method
}
}
Add the following snippet to the android/app/build.gradle
file:
apply from: "../../node_modules/@datadog/mobile-react-native/datadog-configuration.gradle"
This script copies the configuration file to your build assets directory.
Add the following snippet to the AppDelegate.mm
file:
// Add this import
#import "DdSdk.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[DdSdk initFromNative];
// rest of the function
}
Add the datadog-configuration.json
file to your project resources.
Change the Datadog initialization to read from the same file to ensure consistency:
const configuration = new FileBasedConfiguration(require("./datadog-configuration.json"))
<DatadogProvider configuration={configuration}>
// Rest of the app
</DatadogProvider>
Depending on your OS, the configuration file may be in a different location:
In Android, you can specify where to get the file to copy by adding the following snippet:
project.ext.datadog = [
configurationFilePath: "../../../datadog-configuration.json"
]
In iOS, the configuration file gets added to the top of the project resources directory, no matter where it is located.
In React Native, you can specify any path for the file using the require
pattern.
추가 유용한 문서, 링크 및 기사: