| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { ATInitConfiguration, ATSDK } from 'anythink_sdk';
- import { ContextHelper, IBestToast } from '../../../../../../Index';
- import { Singleton } from '../../../utils/ts/utils/SingleTon';
- import { tkBannerAd } from './TkBannerAd';
- import { tkInterstitialAd } from './TkInterstitialAd';
- import { tkRewardAd } from './TkRewardAd';
- import { tkStartAd } from './TkStartAd';
- class TkAdHelper extends Singleton {
- private readonly configuration: ATInitConfiguration = {
- appId: "a68e72d516d235",
- appKey: "ac0ed243c65ffeb1e16d7766bbee902dc",
- networkLogDebug: true
- }
- // demo
- // private readonly configuration: ATInitConfiguration = {
- // appId: "a6704d2dda04f7",
- // appKey: "4f7b9ac17decb9babec83aac078742c7",
- // networkLogDebug: true
- // }
- private readonly bannerPlacementId: string = 'b68e72d9373572'
- // private readonly bannerPlacementId: string = 'b6772057a769c3' //demo
- private readonly interstitialPlacementId: string = 'b68e72d9426e70'
- private readonly rewardPlacementId: string = 'b68e72d92c2b91'
- private readonly startPlacementId: string = 'b68e72d94e2001'
- private readonly nativePlacementId: string = 'b68e72d9214faf'
- init() {
- ATSDK.init(ContextHelper.oldContext.getApplicationContext(), this.configuration)
- ATSDK.start()
- .then((flag) => {
- if (flag) {
- tkRewardAd.init(this.rewardPlacementId)
- tkStartAd.init(this.startPlacementId)
- tkInterstitialAd.init(this.interstitialPlacementId)
- tkBannerAd.init(this.bannerPlacementId)
- } else {
- IBestToast.show("广告初始化失败")
- }
- })
- }
- showRewardAd() {
- tkRewardAd.showRewardAd()
- }
- showInterstitialAd() {
- tkInterstitialAd.showInterstitialAd()
- }
- }
- export const tkAdHelper = TkAdHelper.getInstance()
|