reactnative pangolin 穿山甲
# npm install react-native-pangolin-ad
# 暂无 npm 包, 可通过github地址使用
注意穿山甲要求gradle版本 com.android.tools.build:gradle:xxx
example/android/build.gradle
文件:
allprojects {
repositories {
...其他引用
maven {
url 'https://artifact.bytedance.com/repository/pangle'
}
}
}
info.plist
文件:
<!-- 添加http权限 -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<!-- iOS 14 AppTrackingTransparency -->
<key>NSUserTrackingUsageDescription</key>
<string>该标识符将用于向您投放个性化广告</string>
<!-- 设置穿山甲SKAdNetwork id -->
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>238da6jt44.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>x2jnk7ly8j.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>22mmun2rn5.skadnetwork</string>
</dict>
</array>
- ios: 通过
xcode
将splash_bottom.png
文件拖入ios
文件夹下 - android:
splash_bottom.png
放入android/app/src/main/res/drawable
文件夹
- ios:
ios/PangolinAdExample/AppDelegate.m
文件中
#import <PangolinAd.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[PangolinAd init:@"xxxxx"];
}
- android:
MainApplication.java
文件中
import com.reactnativepangolinad.PangolinAdModule;
public void onCreate() {
PangolinAdModule.init(this, "xxxxxx");
}
- js端使用见
example/src/App.tsx
- 目前发现开屏广告在部分荣耀机型上出现广告加载出后消失的bug, 但广告出现和读秒结果的事件仍被正常触发,未知原因,等待穿山甲官方解决。
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT