Follow the steps below to get your EUM App Key and instrument your React Native application.
The React Native Agent has been tested and certified to work with React Native v0.59.x.
Because React Native is being developed rapidly and hasn't officially released v1, any minor update to React Native could potentially affect the functionality of the React Native Agent.
Get Your Application Key
From the Controller's Getting Started Wizard, create either an iOS or an Android application. You will be given an EUM App Key that you will use to instrument your application. In some cases, multiple mobile applications can share the same key.
If you have completed the Getting Started Wizard, but don't have your EUM App Key, see Get Your Application Key.
Eject Your React Native Application
If you created your React Native application with one of the commands in the following table, you will need to eject the application:
|Command||Why Ejection Is Needed|
This command enables you to quickly set up and run a Native React application with no configuration but does not provide the full development environment required by the React Native Agent.
|Expo projects do not currently support the React Native Agent module.|
If you created your app with create-react-native-app, use
npm to eject the app. If you used
expo, run the
expo command below to eject the app.
From your project directory, run the command appropriate for your use case:
Install the React Native Agent
Instrumentation management interface.
Install and link the React Native Agent:
Build the configuration to enable the build-time instrumentation of your application:
The React Native Agent CLI assumes you've kept the default project structure created with the
Manually Install the React Native Package (Only If Required)
Most users do not have to do manually install the package, but the command above may fail if your iOS and Android projects are heavily modified.
Follow these steps if you need to manually install the React Native package:
Android Add the following line to your Make sure the file Also, iOS
settings.gradle contains a reference to the Appdynamics agent module as shown below. This is should have been added automatically by the command
android/app/build.gradle should contain a reference to the Appdynamics agent module.
libsqlite3 to your project as explained in Add Required Libraries (iOS Only).
Add the following line to your
Make sure the file
iOSFor iOS, link the Appdynamics agent module like any other native module. Make sure to add
Add Required Libraries (iOS Only)
- From the React Native application root, open the iOS project file in the
iosdirectory with XCode.
From XCode, select your project in the Project Navigator.
Navigate to the Build Phases tab.
- Under Link Binary With Libraries, click Add.
- Click Add.
This requirement will be removed in a future release.
Add Permissions (Android Only)
Add the following permissions to your app's
AndroidManifest.xml (which should be located under
The React Native Agent tries to minimize its network footprint. Without this permission, the agent always assumes poor network conditions and some metrics might not get reported.
Instrument Your Application Code
index.js file of your React application, do the following:
At the top of the file near the other
importstatements, add the following line of code to import the Native React Agent:
In the same file and in the global scope, initialize the instrumentation with the following, making sure to replace
<EUM_APP_KEY>with a string containing your EUM App Key.
Verify that your
index.jsfile looks similar to the following:
Build and Run Your React Native Applications (Optional)
Run the command to build and run the app for your platform.
From the Controller UI, verify that the instrumentation was successful.
Point to an On-Premises EUM Server (Optional)
To use an on-premises EUM Server, you pass the URL to the on-premises EUM Server when you initialize the instrumentation with the EUM App Key from Get Your Application Key.