This library is a thin wrapper around the iOS and Android Amazon SDK for Amazon Publisher Services (APS). This library requires an APS account and the installation of the Amazon iOS and Android SDK. Before installing this library please follow Amazon's install instructions here.
NOTE
It's important that you save the Amazon iOS SDK to [your project's name]/ios/Frameworks/
. That is where this package looks for Amazon's DTBiOSSDK.framework
.
$ npm install react-native-amazon-tam --save
$ react-native link react-native-amazon-tam
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-amazon-tam
and addRNAmazonTAM.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNAmazonTAM.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.krazylabs.rnamazontam.RNAmazonTAMPackage;
to the imports at the top of the file - Add
new RNAmazonTAMPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-amazon-tam' project(':react-native-amazon-tam').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-amazon-tam/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-amazon-tam')
To request a banner ad from APS, use requestBannerAd(width: Int, height: Int, slotUUID: String)
.
import { requestBannerAd } from 'react-native-amazon-tam';
const ad = await requestBannerAd(320, 50, 'your-slot-uuid');
To request a banner ad from APS, use requestInterstitialAd(slotUUID: String)
.
import { requestInterstitialAd } from 'react-native-amazon-tam';
const ad = await requestInterstitialAd('your-slot-uuid');