You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ bundle install
14
14
bundle exec pod install
15
15
16
16
# Build Android and iOS example app
17
-
yarn ../..
17
+
cd - # Go back to the root directory of the repo
18
18
yarn build:android
19
19
yarn build:ios
20
20
```
@@ -40,9 +40,9 @@ The [example app](/example/) demonstrates usage of the library. You need to run
40
40
41
41
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
42
42
43
-
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/TrackingplanReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > trackingplan-react-native`.
43
+
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/TrackingplanReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > TrackingplanReactNative`.
44
44
45
-
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `trackingplan-react-native` under `Android`.
45
+
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `trackingplan_react-native` under `Android`.
46
46
47
47
You can use various commands from the root directory to work with the project.
> **Important:** The above approach is recommended to add the Trackingplan adapter. If you choose to hardcode a version string instead of using the programmatic approach, you MUST ensure that it exactly matches the version used by trackingplan-react-native, otherwise your app may experience compatibility issues.
102
+
### ✅ Expo Setup Complete!
55
103
56
-
2. Modify your `/android/app/build.gradle` to apply the Trackingplan Gradle plugin.
104
+
The Expo plugin automatically handles:
57
105
58
-
```gradle
59
-
// ... other plugins
60
-
apply plugin: "com.trackingplan.client"
61
-
```
106
+
- Android Gradle dependencies and configuration
107
+
- iOS CocoaPods dependency
108
+
- Native initialization code with your Trackingplan ID
62
109
63
-
3. Open your `/android/app/src/main/java/com/{projectName}/MainApplication.kt` and add the following:
110
+
**No additional configuration needed!**
64
111
65
-
At the top of the file, import the Trackingplan SDK:
112
+
---
66
113
67
-
```kotlin
68
-
importcom.trackingplan.client.sdk.Trackingplan;
69
-
```
114
+
## React Native CLI Projects
70
115
71
-
Within your existing `onCreate` method, add the following right after `super.onCreate()`:
116
+
For React Native CLI projects, manual native configuration is required.
72
117
73
-
```kotlin
74
-
overridefunonCreate() {
75
-
super.onCreate()
76
-
Trackingplan.init("YOUR_TP_ID").start(this)
77
-
// ...other code
78
-
}
118
+
### Step 1: Install the Package
119
+
120
+
```sh
121
+
# Using npm
122
+
npm install --save @trackingplan/react-native
123
+
124
+
# Using yarn
125
+
yarn add @trackingplan/react-native
79
126
```
80
127
81
-
### iOS
128
+
### Step 2: Android Configuration
82
129
83
-
Open your `/ios/{projectName}/AppDelegate.swift` file and add the following:
130
+
1.**Update root build.gradle**
84
131
85
-
At the top of the file, import the Trackingplan SDK:
132
+
Open `/android/build.gradle` and add the Trackingplan adapter:
Trackingplan.initialize(tpId: "YOUR_TP_ID") // Add this line
185
+
// ...other code
186
+
returntrue
187
+
}
97
188
}
98
189
```
99
190
100
-
## Autolinking & Rebuilding
101
-
102
-
Once the above steps have been completed, the Trackingplan for React Native SDK must be linked to your project and your application needs to be rebuilt.
103
-
104
-
To automatically link the package, rebuild your project:
191
+
### Step 4: Link and Rebuild
105
192
106
-
```console
107
-
# Android apps
193
+
```sh
194
+
#For Android
108
195
npx react-native run-android
109
196
110
-
# iOS apps
197
+
#For iOS
111
198
cd ios/
112
199
pod install --repo-update
113
200
cd ..
114
201
npx react-native run-ios
115
202
```
116
203
204
+
### ✅ React Native CLI Setup Complete!
205
+
117
206
## Usage
118
207
119
208
At this point, your app is ready to start monitoring traffic sent to your data destinations with Trackingplan.
0 commit comments