Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## 4.3.1

### Features

- **Composable native ads**: AdMob-style JSX layout via
`AppodealNativeAdView` + asset views (`media` / `icon` / `title` /
`description` / `callToAction` / `attribution`) on Android and iOS.
Matches Appodeal Android custom `NativeAdView` and iOS `APDNativeAdView`
asset binding — app owns styling in React Native.

### Changes

- Stock `<AppodealNative adTemplate="..." />` remains for
`newsFeed` / `appWall` / `contentStream` only (no app-specific templates).

## 4.3.0

### Features

- **Native ads**: full React Native bridge for Appodeal Native (the previously
missing format). Adds `AppodealAdType.NATIVE`, module APIs
(`getNativeAds`, `getAvailableNativeAdsCount`, `destroyNativeAd`,
`cacheNativeAds`, `setPreferredNativeContentType`),
`AppodealNativeEvents`, and the `<AppodealNative />` view component
(templates: `newsFeed` / `appWall` / `contentStream`).
- Android: `Appodeal.NATIVE` type mapping, `NativeCallbacks`, ad store,
template `NativeAdView` registration.
- iOS: `APDNativeAdQueue` store, `getViewForPlacement` view binding,
native event constants.

## 4.2.0

### Features
Expand Down
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ Appodeal.initialize('YOUR_APPODEAL_APP_KEY',
AppodealAdType.INTERSTITIAL |
AppodealAdType.REWARDED_VIDEO |
AppodealAdType.BANNER |
AppodealAdType.MREC
AppodealAdType.MREC |
AppodealAdType.NATIVE
);
```

Expand All @@ -558,6 +559,7 @@ Use the type codes below to set the preferred ad format:
- `AppodealAdType.REWARDED_VIDEO` for rewarded videos.
- `AppodealAdType.BANNER` for banners.
- `AppodealAdType.MREC` for 300*250 banners.
- `AppodealAdType.NATIVE` for native ads.

2. Configure SDK

Expand Down Expand Up @@ -818,6 +820,45 @@ import { AppodealMrec } from 'react-native-appodeal';
/>
```

### Native ads

Pull native ads from the SDK cache, then bind each ad id to `<AppodealNative />`:

```javascript
import Appodeal, {
AppodealAdType,
AppodealNative,
AppodealNativeEvents,
} from 'react-native-appodeal';

// Include NATIVE in initialize(), then:
Appodeal.cacheNativeAds(3);

Appodeal.addEventListener(AppodealNativeEvents.LOADED, () => {
const ads = Appodeal.getNativeAds(1);
// ads[0] => { id, title, description, callToAction, rating, containsVideo, predictedEcpm }
});

// Render a platform template for a pulled ad:
<AppodealNative
adId={ads[0].id}
placement="default"
adTemplate="contentStream" // "newsFeed" | "appWall" | "contentStream"
onAdLoaded={() => console.log('Native shown')}
onAdFailedToLoad={() => console.log('Native failed')}
onAdClicked={() => console.log('Native clicked')}
style={{ width: '100%', height: 300 }}
/>
```

Optional:

```javascript
Appodeal.setPreferredNativeContentType('auto'); // 'auto' | 'noVideo' | 'video'
Appodeal.getAvailableNativeAdsCount();
Appodeal.destroyNativeAd(adId);
```

## Privacy Policy and Consent

> Note: Keep in mind that it's best to contact qualified legal professionals, if you haven't done so already, to get
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.appodeal.rnappodeal;

import android.view.View;
import android.widget.TextView;

import com.appodeal.ads.nativead.NativeAdView;
import com.appodeal.ads.nativead.NativeIconView;
import com.appodeal.ads.nativead.NativeMediaView;

/**
* Binds custom native-ad assets onto {@link NativeAdView}.
*
* <p>Appodeal's {@code NativeAdView} keeps JavaBean setters for Java callers, but the Kotlin
* metadata is obfuscated — so a Kotlin subclass cannot resolve {@code setMediaView} /
* {@code mediaView = ...}. Call the setters from Java instead.
*/
public final class NativeAdViewAssetBinder {
private NativeAdViewAssetBinder() {}

public static void bind(
NativeAdView view,
NativeMediaView media,
NativeIconView icon,
View title,
View description,
View callToAction,
TextView attribution) {
if (media != null) {
view.setMediaView(media);
}
if (icon != null) {
view.setIconView(icon);
}
if (title != null) {
view.setTitleView(title);
}
if (description != null) {
view.setDescriptionView(description);
}
if (callToAction != null) {
view.setCallToActionView(callToAction);
}
if (attribution != null) {
view.setAdAttributionView(attribution);
}
}
}
Loading