@advergic-ads/react-native-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/AdvergicReactNative.podspec +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +329 -0
  4. package/android/advergic-bridge/build.gradle +58 -0
  5. package/android/advergic-bridge/libs/advergic-sdk.aar +0 -0
  6. package/android/advergic-bridge/src/main/java/com/advergic/reactnative/AdvergicBannerViewManager.kt +194 -0
  7. package/android/advergic-bridge/src/main/java/com/advergic/reactnative/AdvergicReactNativeModule.java +401 -0
  8. package/android/advergic-bridge/src/main/java/com/advergic/reactnative/AdvergicReactNativePackage.java +25 -0
  9. package/android/app/build.gradle +144 -0
  10. package/android/app/libs/advergic-sdk.aar +0 -0
  11. package/android/app/src/main/AndroidManifest.xml +30 -0
  12. package/android/app/src/main/java/com/advergic/reactnative/AdvergicReactNativePackage.java +26 -0
  13. package/android/app/src/main/java/com/facebook/react/viewmanagers/AdvergicBannerViewManagerInterface.java +8 -0
  14. package/android/libs/advergic-sdk.aar +0 -0
  15. package/android/settings.gradle +7 -0
  16. package/index.d.ts +135 -0
  17. package/index.js +27 -0
  18. package/install.js +158 -0
  19. package/ios/AdvergicBannerView.swift +59 -0
  20. package/ios/AdvergicBannerViewManager.m +18 -0
  21. package/ios/AdvergicBannerViewManager.swift +24 -0
  22. package/ios/AdvergicReactNativeModule.m +36 -0
  23. package/ios/AdvergicReactNativeModule.swift +363 -0
  24. package/package.json +57 -0
  25. package/react-native.config.js +18 -0
  26. package/src/advergic/AdvergicBannerAd.tsx +51 -0
  27. package/src/advergic/AdvergicSDK.ts +318 -0
  28. package/src/advergic/index.ts +11 -0
  29. package/src/advergic/types.ts +23 -0
@@ -0,0 +1,401 @@
1
+ package com.advergic.reactnative;
2
+
3
+ import android.app.Activity;
4
+ import android.os.Handler;
5
+ import android.os.Looper;
6
+ import android.view.ViewGroup;
7
+
8
+ import com.advergic.sdk.core.AdvergicSdk;
9
+ import com.advergic.sdk.interfaces.AppOpenAdCallbacks;
10
+ import com.advergic.sdk.interfaces.BannerAdCallback;
11
+ import com.advergic.sdk.interfaces.InterstitialAdCallback;
12
+ import com.advergic.sdk.interfaces.NativeAdCallback;
13
+ import com.advergic.sdk.interfaces.RewardedAdCallback;
14
+ import com.facebook.react.bridge.Arguments;
15
+ import com.facebook.react.bridge.Promise;
16
+ import com.facebook.react.bridge.ReactApplicationContext;
17
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
+ import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.bridge.WritableMap;
20
+ import com.facebook.react.bridge.WritableArray;
21
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
22
+ import androidx.lifecycle.LiveData;
23
+ import java.util.EnumSet;
24
+
25
+ public class AdvergicReactNativeModule extends ReactContextBaseJavaModule {
26
+
27
+ public static final String NAME = "AdvergicSDK";
28
+
29
+ public AdvergicReactNativeModule(ReactApplicationContext reactContext) {
30
+ super(reactContext);
31
+ }
32
+
33
+ @Override
34
+ public String getName() {
35
+ return NAME;
36
+ }
37
+
38
+ private void sendEvent(String eventName, WritableMap params) {
39
+ getReactApplicationContext()
40
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
41
+ .emit(eventName, params);
42
+ }
43
+
44
+ private WritableMap createAdUnitMap(String adUnitId) {
45
+ WritableMap map = Arguments.createMap();
46
+ map.putString("adUnitId", adUnitId);
47
+ return map;
48
+ }
49
+
50
+ private WritableMap createErrorMap(String adUnitId, String error) {
51
+ WritableMap map = Arguments.createMap();
52
+ map.putString("adUnitId", adUnitId);
53
+ map.putString("error", error);
54
+ return map;
55
+ }
56
+
57
+ @ReactMethod
58
+ public void initialize(String apiKey, Promise promise) {
59
+ try {
60
+ android.app.Application app = (android.app.Application) getReactApplicationContext().getApplicationContext();
61
+ AdvergicSdk.initialize(app, apiKey);
62
+
63
+ // observeForever must be called on the main thread
64
+ new Handler(Looper.getMainLooper()).post(() -> {
65
+ AdvergicSdk.getBotDetectionStatusLiveData().observeForever(passed -> {
66
+ WritableMap params = Arguments.createMap();
67
+ params.putBoolean("passed", passed);
68
+ sendEvent("OnBotDetectionResult", params);
69
+ });
70
+
71
+ AdvergicSdk.getAdUnitsLiveData().observeForever(units -> {
72
+ if (units != null && !units.isEmpty()) {
73
+ WritableMap params = Arguments.createMap();
74
+ params.putBoolean("initialized", true);
75
+ params.putInt("adUnitCount", units.size());
76
+ sendEvent("OnSDKInitialized", params);
77
+ promise.resolve(true);
78
+ }
79
+ });
80
+ });
81
+ } catch (Exception e) {
82
+ promise.reject("INIT_ERROR", e.getMessage(), e);
83
+ }
84
+ }
85
+
86
+ @ReactMethod
87
+ public void canServeAds(Promise promise) {
88
+ promise.resolve(AdvergicSdk.canServeAds());
89
+ }
90
+
91
+ @ReactMethod
92
+ public void getAdUnits(Promise promise) {
93
+ try {
94
+ WritableArray adUnitsArray = Arguments.createArray();
95
+ LiveData<?> liveData = AdvergicSdk.getAdUnitsLiveData();
96
+
97
+ if (liveData != null) {
98
+ Object adUnitsValue = liveData.getValue();
99
+ if (adUnitsValue instanceof java.util.List) {
100
+ java.util.List<?> adUnits = (java.util.List<?>) adUnitsValue;
101
+ for (Object adUnitObj : adUnits) {
102
+ try {
103
+ java.lang.reflect.Field configField = adUnitObj.getClass().getDeclaredField("configuration");
104
+ configField.setAccessible(true);
105
+ Object configuration = configField.get(adUnitObj);
106
+
107
+ if (configuration != null) {
108
+ java.lang.reflect.Method getConfigId = configuration.getClass().getMethod("getConfigId");
109
+ java.lang.reflect.Method getAdFormats = configuration.getClass().getMethod("getAdFormats");
110
+
111
+ String configId = (String) getConfigId.invoke(configuration);
112
+ EnumSet<?> adFormats = (EnumSet<?>) getAdFormats.invoke(configuration);
113
+
114
+ WritableMap map = Arguments.createMap();
115
+ map.putString("id", configId);
116
+ map.putString("name", configId);
117
+
118
+ String type = "unknown";
119
+ if (adFormats != null) {
120
+ if (adFormats.contains(com.advergic.sdk.mobile.api.data.AdFormat.BANNER)) {
121
+ type = "banner";
122
+ } else if (adFormats.contains(com.advergic.sdk.mobile.api.data.AdFormat.INTERSTITIAL)) {
123
+ type = "interstitial";
124
+ } else if (adFormats.contains(com.advergic.sdk.mobile.api.data.AdFormat.VAST)) {
125
+ type = "rewarded";
126
+ } else if (adFormats.contains(com.advergic.sdk.mobile.api.data.AdFormat.NATIVE)) {
127
+ type = "native";
128
+ }
129
+ }
130
+ map.putString("type", type);
131
+ adUnitsArray.pushMap(map);
132
+ }
133
+ } catch (Exception reflectionEx) {
134
+ // Skip ad units we can't reflect into
135
+ }
136
+ }
137
+ }
138
+ }
139
+ promise.resolve(adUnitsArray);
140
+ } catch (Exception e) {
141
+ promise.reject("GET_AD_UNITS_ERROR", e.getMessage(), e);
142
+ }
143
+ }
144
+
145
+ @ReactMethod
146
+ public void performFollowUpBotDetection() {
147
+ AdvergicSdk.performFollowUpBotDetection();
148
+ }
149
+
150
+ @ReactMethod
151
+ public void showBannerAd(String adUnitId, int containerId) {
152
+ Activity activity = getCurrentActivity();
153
+ if (activity == null) {
154
+ sendEvent("OnBannerAdFailedToLoad", createErrorMap(adUnitId, "No activity"));
155
+ return;
156
+ }
157
+
158
+ activity.runOnUiThread(() -> {
159
+ ViewGroup container = activity.findViewById(containerId);
160
+ if (container == null) {
161
+ sendEvent("OnBannerAdFailedToLoad", createErrorMap(adUnitId, "Container not found"));
162
+ return;
163
+ }
164
+
165
+ container.setLayoutParams(new android.view.ViewGroup.LayoutParams(
166
+ android.view.ViewGroup.LayoutParams.MATCH_PARENT,
167
+ android.view.ViewGroup.LayoutParams.WRAP_CONTENT
168
+ ));
169
+
170
+ AdvergicSdk.showBannerAd(activity, adUnitId, container, new BannerAdCallback() {
171
+ @Override
172
+ public void onAdLoaded() {
173
+ sendEvent("OnBannerAdLoaded", createAdUnitMap(adUnitId));
174
+ }
175
+
176
+ @Override
177
+ public void onAdFailedToLoad(String error) {
178
+ sendEvent("OnBannerAdFailedToLoad", createErrorMap(adUnitId, error));
179
+ }
180
+
181
+ @Override
182
+ public void onAdClicked() {
183
+ sendEvent("OnBannerAdClicked", createAdUnitMap(adUnitId));
184
+ }
185
+
186
+ @Override
187
+ public void onAdImpression() {
188
+ sendEvent("OnBannerAdImpression", createAdUnitMap(adUnitId));
189
+ }
190
+ });
191
+ });
192
+ }
193
+
194
+ @ReactMethod
195
+ public void showInterstitialAd(String adUnitId) {
196
+ Activity activity = getCurrentActivity();
197
+ if (activity == null) {
198
+ sendEvent("OnInterstitialAdFailedToLoad", createErrorMap(adUnitId, "No activity"));
199
+ return;
200
+ }
201
+
202
+ activity.runOnUiThread(() -> {
203
+ AdvergicSdk.showInterstitialAd(activity, adUnitId, new InterstitialAdCallback() {
204
+ @Override
205
+ public void onAdLoaded() {
206
+ sendEvent("OnInterstitialAdLoaded", createAdUnitMap(adUnitId));
207
+ }
208
+
209
+ @Override
210
+ public void onAdFailedToLoad(String error) {
211
+ sendEvent("OnInterstitialAdFailedToLoad", createErrorMap(adUnitId, error));
212
+ }
213
+
214
+ @Override
215
+ public void onAdShowedFullScreenContent() {
216
+ sendEvent("OnInterstitialAdShowed", createAdUnitMap(adUnitId));
217
+ }
218
+
219
+ @Override
220
+ public void onAdDismissedFullScreenContent() {
221
+ sendEvent("OnInterstitialAdDismissed", createAdUnitMap(adUnitId));
222
+ }
223
+
224
+ @Override
225
+ public void onAdFailedToShowFullScreenContent(String error) {
226
+ sendEvent("OnInterstitialAdFailedToShow", createErrorMap(adUnitId, error));
227
+ }
228
+
229
+ @Override
230
+ public void onAdClicked() {
231
+ sendEvent("OnInterstitialAdClicked", createAdUnitMap(adUnitId));
232
+ }
233
+
234
+ @Override
235
+ public void onAdImpression() {
236
+ sendEvent("OnInterstitialAdImpression", createAdUnitMap(adUnitId));
237
+ }
238
+ });
239
+ });
240
+ }
241
+
242
+ @ReactMethod
243
+ public void showRewardedAd(String adUnitId) {
244
+ Activity activity = getCurrentActivity();
245
+ if (activity == null) {
246
+ sendEvent("OnRewardedAdFailedToLoad", createErrorMap(adUnitId, "No activity"));
247
+ return;
248
+ }
249
+
250
+ activity.runOnUiThread(() -> {
251
+ AdvergicSdk.showRewardedAd(activity, adUnitId, new RewardedAdCallback() {
252
+ @Override
253
+ public void onRewardedAdLoaded() {
254
+ sendEvent("OnRewardedAdLoaded", createAdUnitMap(adUnitId));
255
+ }
256
+
257
+ @Override
258
+ public void onRewardedAdFailedToLoad(String error) {
259
+ sendEvent("OnRewardedAdFailedToLoad", createErrorMap(adUnitId, error));
260
+ }
261
+
262
+ @Override
263
+ public void onRewardedAdShowFullScreen() {
264
+ sendEvent("OnRewardedAdShowed", createAdUnitMap(adUnitId));
265
+ }
266
+
267
+ @Override
268
+ public void onRewardedFailedToShow(String error) {
269
+ sendEvent("OnRewardedAdFailedToShow", createErrorMap(adUnitId, error));
270
+ }
271
+
272
+ @Override
273
+ public void onRewardedAdOpened() {
274
+ sendEvent("OnRewardedAdOpened", createAdUnitMap(adUnitId));
275
+ }
276
+
277
+ @Override
278
+ public void onRewardedAdClicked() {
279
+ sendEvent("OnRewardedAdClicked", createAdUnitMap(adUnitId));
280
+ }
281
+
282
+ @Override
283
+ public void onRewardedAdClosed() {
284
+ sendEvent("OnRewardedAdClosed", createAdUnitMap(adUnitId));
285
+ }
286
+
287
+ @Override
288
+ public void onUserEarnedReward() {
289
+ sendEvent("OnUserEarnedReward", createAdUnitMap(adUnitId));
290
+ }
291
+ });
292
+ });
293
+ }
294
+
295
+ @ReactMethod
296
+ public void showAppOpenAd(String adUnitId) {
297
+ Activity activity = getCurrentActivity();
298
+ if (activity == null) {
299
+ sendEvent("OnAppOpenAdFailedToLoad", createErrorMap(adUnitId, "No activity"));
300
+ return;
301
+ }
302
+
303
+ activity.runOnUiThread(() -> {
304
+ AdvergicSdk.showAppOpen(activity, adUnitId, new AppOpenAdCallbacks() {
305
+ @Override
306
+ public void onAdLoaded() {
307
+ sendEvent("OnAppOpenAdLoaded", createAdUnitMap(adUnitId));
308
+ }
309
+
310
+ @Override
311
+ public void onAdFailedToLoad(String error) {
312
+ sendEvent("OnAppOpenAdFailedToLoad", createErrorMap(adUnitId, error));
313
+ }
314
+
315
+ @Override
316
+ public void onAdShowedFullScreenContent() {
317
+ sendEvent("OnAppOpenAdShowed", createAdUnitMap(adUnitId));
318
+ }
319
+
320
+ @Override
321
+ public void onAdDismissedFullScreenContent() {
322
+ sendEvent("OnAppOpenAdDismissed", createAdUnitMap(adUnitId));
323
+ }
324
+
325
+ @Override
326
+ public void onAdFailedToShowFullScreenContent(String error) {
327
+ sendEvent("OnAppOpenAdFailedToShow", createErrorMap(adUnitId, error));
328
+ }
329
+
330
+ @Override
331
+ public void onAdClicked() {
332
+ sendEvent("OnAppOpenAdClicked", createAdUnitMap(adUnitId));
333
+ }
334
+
335
+ @Override
336
+ public void onAdImpression() {
337
+ sendEvent("OnAppOpenAdImpression", createAdUnitMap(adUnitId));
338
+ }
339
+ });
340
+ });
341
+ }
342
+
343
+ @ReactMethod
344
+ public void showNativeAd(String adUnitId, int containerId) {
345
+ Activity activity = getCurrentActivity();
346
+ if (activity == null) {
347
+ sendEvent("OnNativeAdFailedToLoad", createErrorMap(adUnitId, "No activity"));
348
+ return;
349
+ }
350
+
351
+ activity.runOnUiThread(() -> {
352
+ ViewGroup container = activity.findViewById(containerId);
353
+ if (container == null) {
354
+ sendEvent("OnNativeAdFailedToLoad", createErrorMap(adUnitId, "Container not found"));
355
+ return;
356
+ }
357
+
358
+ AdvergicSdk.showNativeAd(activity, adUnitId, container, new NativeAdCallback() {
359
+ @Override
360
+ public void onAdLoaded() {
361
+ sendEvent("OnNativeAdLoaded", createAdUnitMap(adUnitId));
362
+ }
363
+
364
+ @Override
365
+ public void onAdFailedToLoad(String error) {
366
+ sendEvent("OnNativeAdFailedToLoad", createErrorMap(adUnitId, error));
367
+ }
368
+
369
+ @Override
370
+ public void onAdClicked() {
371
+ sendEvent("OnNativeAdClicked", createAdUnitMap(adUnitId));
372
+ }
373
+
374
+ @Override
375
+ public void onAdImpression() {
376
+ sendEvent("OnNativeAdImpression", createAdUnitMap(adUnitId));
377
+ }
378
+
379
+ @Override
380
+ public void onPrebidAdNotFound() {
381
+ sendEvent("OnNativePrebidAdNotFound", createAdUnitMap(adUnitId));
382
+ }
383
+
384
+ @Override
385
+ public void onPrebidAdNotValid() {
386
+ sendEvent("OnNativePrebidAdNotValid", createAdUnitMap(adUnitId));
387
+ }
388
+ });
389
+ });
390
+ }
391
+
392
+ @ReactMethod
393
+ public void addListener(String eventName) {
394
+ // Required for RN built-in EventEmitter
395
+ }
396
+
397
+ @ReactMethod
398
+ public void removeListeners(int count) {
399
+ // Required for RN built-in EventEmitter
400
+ }
401
+ }
@@ -0,0 +1,25 @@
1
+ package com.advergic.reactnative;
2
+
3
+ import com.facebook.react.ReactPackage;
4
+ import com.facebook.react.bridge.NativeModule;
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+ import com.facebook.react.uimanager.ViewManager;
7
+
8
+ import java.util.Arrays;
9
+ import java.util.List;
10
+
11
+ public class AdvergicReactNativePackage implements ReactPackage {
12
+ @Override
13
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
14
+ return Arrays.<NativeModule>asList(
15
+ new AdvergicReactNativeModule(reactContext)
16
+ );
17
+ }
18
+
19
+ @Override
20
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
21
+ return Arrays.<ViewManager>asList(
22
+ new AdvergicBannerViewManager()
23
+ );
24
+ }
25
+ }
@@ -0,0 +1,144 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
+ // reactNativeDir = file("../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
+ // codegenDir = file("../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
+ // cliFile = file("../../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
56
+
57
+ /**
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
+ */
60
+ def enableProguardInReleaseBuilds = false
61
+
62
+ /**
63
+ * The preferred build flavor of JavaScriptCore (JSC)
64
+ *
65
+ * For example, to use the international variant, you can use:
66
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
67
+ *
68
+ * The international variant includes ICU i18n library and necessary data
69
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
+ * give correct results when using with locales other than en-US. Note that
71
+ * this variant is about 6MiB larger per architecture than default.
72
+ */
73
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
74
+
75
+ android {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
79
+
80
+ namespace "com.advergic.dramafy"
81
+ defaultConfig {
82
+ applicationId "com.advergic.dramafy"
83
+ minSdkVersion rootProject.ext.minSdkVersion
84
+ targetSdkVersion rootProject.ext.targetSdkVersion
85
+ versionCode 1
86
+ versionName "1.0"
87
+ multiDexEnabled true
88
+ }
89
+ signingConfigs {
90
+ debug {
91
+ storeFile file('debug.keystore')
92
+ storePassword 'android'
93
+ keyAlias 'androiddebugkey'
94
+ keyPassword 'android'
95
+ }
96
+ }
97
+ buildTypes {
98
+ debug {
99
+ signingConfig signingConfigs.debug
100
+ }
101
+ release {
102
+ // Caution! In production, you need to generate your own keystore file.
103
+ // see https://reactnative.dev/docs/signed-apk-android.
104
+ signingConfig signingConfigs.debug
105
+ minifyEnabled enableProguardInReleaseBuilds
106
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
107
+ }
108
+ }
109
+ }
110
+
111
+ repositories {
112
+ flatDir {
113
+ dirs file(rootProject.projectDir.absolutePath + '/app/libs')
114
+ }
115
+ }
116
+
117
+ dependencies {
118
+ // The version of react-native is set by the React Native Gradle Plugin
119
+ implementation("com.facebook.react:react-android")
120
+
121
+ if (hermesEnabled.toBoolean()) {
122
+ implementation("com.facebook.react:hermes-android")
123
+ } else {
124
+ implementation jscFlavor
125
+ }
126
+
127
+ implementation project(':advergic-bridge')
128
+ implementation(name: 'advergic-sdk-debug', ext: 'aar')
129
+ implementation 'com.applovin:applovin-sdk:13.2.0'
130
+ implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.9.0'
131
+ implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.0'
132
+ implementation 'androidx.room:room-runtime:2.7.0'
133
+ implementation 'androidx.room:room-ktx:2.7.0'
134
+ implementation 'com.google.android.material:material:1.9.0'
135
+ implementation 'com.google.code.gson:gson:2.10.1'
136
+ implementation 'com.google.android.gms:play-services-ads:24.6.0'
137
+ implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0'
138
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
139
+ implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
140
+ implementation 'com.squareup.okhttp3:okhttp:4.11.0'
141
+ implementation 'com.github.bumptech.glide:glide:4.15.1'
142
+ implementation 'io.opentelemetry:opentelemetry-api:1.42.1'
143
+ implementation 'androidx.multidex:multidex:2.0.1'
144
+ }
@@ -0,0 +1,30 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:theme="@style/AppTheme"
12
+ android:usesCleartextTraffic="${usesCleartextTraffic}"
13
+ android:supportsRtl="true">
14
+ <meta-data
15
+ android:name="com.google.android.gms.ads.APPLICATION_ID"
16
+ android:value="ca-app-pub-3940256099942544~3347511713" />
17
+ <activity
18
+ android:name=".MainActivity"
19
+ android:label="@string/app_name"
20
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
21
+ android:launchMode="singleTask"
22
+ android:windowSoftInputMode="adjustResize"
23
+ android:exported="true">
24
+ <intent-filter>
25
+ <action android:name="android.intent.action.MAIN" />
26
+ <category android:name="android.intent.category.LAUNCHER" />
27
+ </intent-filter>
28
+ </activity>
29
+ </application>
30
+ </manifest>
@@ -0,0 +1,26 @@
1
+ package com.advergic.reactnative;
2
+
3
+ import com.facebook.react.ReactPackage;
4
+ import com.facebook.react.bridge.NativeModule;
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+ import com.facebook.react.uimanager.ViewManager;
7
+
8
+ import java.util.ArrayList;
9
+ import java.util.List;
10
+
11
+ public class AdvergicReactNativePackage implements ReactPackage {
12
+
13
+ @Override
14
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
15
+ List<NativeModule> modules = new ArrayList<>();
16
+ modules.add(new AdvergicReactNativeModule(reactContext));
17
+ return modules;
18
+ }
19
+
20
+ @Override
21
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
22
+ List<ViewManager> viewManagers = new ArrayList<>();
23
+ viewManagers.add(new AdvergicBannerViewManager());
24
+ return viewManagers;
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ package com.facebook.react.viewmanagers;
2
+
3
+ import android.view.View;
4
+ import androidx.annotation.Nullable;
5
+
6
+ public interface AdvergicBannerViewManagerInterface<T extends View> {
7
+ void setAdUnitId(T view, @Nullable String value);
8
+ }
Binary file
@@ -0,0 +1,7 @@
1
+ pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
2
+ plugins { id("com.facebook.react.settings") }
3
+ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4
+ rootProject.name = 'AdsTest'
5
+ include ':app'
6
+ include ':advergic-bridge'
7
+ includeBuild('../node_modules/@react-native/gradle-plugin')