Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
appzxhy
Commits
3644c834
Commit
3644c834
authored
Jul 01, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[修改]pangle上报
parent
5222d239
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
329 additions
and
89 deletions
+329
-89
build.gradle.kts
app/build.gradle.kts
+15
-5
applovin-adapter-13.3.0.1.aar
app/libs/adapter/applovin-adapter-13.3.0.1.aar
+0
-0
bigo-adapter-5.3.0.2.aar
app/libs/adapter/bigo-adapter-5.3.0.2.aar
+0
-0
inmobi-adapter-10.8.3.1.aar
app/libs/adapter/inmobi-adapter-10.8.3.1.aar
+0
-0
mintegral-adapter-16.9.71.1.aar
app/libs/adapter/mintegral-adapter-16.9.71.1.aar
+0
-0
vungle-adapter-7.5.0.1.aar
app/libs/adapter/vungle-adapter-7.5.0.1.aar
+0
-0
open_ad_sdk_6.5.7.1.aar
app/libs/open_ad_sdk_6.5.7.1.aar
+0
-0
proguard-rules.pro
app/proguard-rules.pro
+3
-2
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+62
-49
MyApplication.kt
app/src/main/java/com/base/appzxhy/MyApplication.kt
+3
-1
AdsMgr.kt
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
+1
-28
PangleActivity.kt
...n/java/com/base/appzxhy/business/pangle/PangleActivity.kt
+3
-2
PangleEvent.kt
...main/java/com/base/appzxhy/business/pangle/PangleEvent.kt
+117
-0
PangleInit.kt
.../main/java/com/base/appzxhy/business/pangle/PangleInit.kt
+90
-0
PangleInterMgr.kt
...n/java/com/base/appzxhy/business/pangle/PangleInterMgr.kt
+6
-0
PangleOpenMgr.kt
...in/java/com/base/appzxhy/business/pangle/PangleOpenMgr.kt
+6
-0
Guide2Ac.kt
app/src/main/java/com/base/appzxhy/ui/guide2/Guide2Ac.kt
+2
-1
GuideAc.kt
app/src/main/java/com/base/appzxhy/ui/guide2/GuideAc.kt
+2
-1
keep.xml
app/src/main/res/raw/keep.xml
+18
-0
settings.gradle.kts
settings.gradle.kts
+1
-0
No files found.
app/build.gradle.kts
View file @
3644c834
...
@@ -202,10 +202,20 @@ dependencies {
...
@@ -202,10 +202,20 @@ dependencies {
// implementation("com.android.billingclient:billing-ktx:$billing_version")
// implementation("com.android.billingclient:billing-ktx:$billing_version")
//目前由于隐私原因,暂不支持通过maven的方式集成SDK,请联系Pangle团队手动获取最新版本的SDK
implementation
(
"com.google.android.gms:play-services-ads-identifier:18.2.0"
)
// implementation("com.google.android.gms:play-services-ads-identifier:18.2.0")
// If you use a version below 7.1.0.0, it depends on 'ads-sdk'
//implementation ('com.pangle.global:ads-sdk:6.5.0.6')
//implementation ('com.pangle.global:ads-sdk:6.5.0.6')
// If you use version 7.1.0.0 and above, it depends on 'pag-sdk'
// implementation("com.pangle.global:pag-sdk:7.1.0.4")
implementation
(
"com.pangle.global:pag-sdk:7.1.0.4"
)
// Adjust 核心 SDK
implementation
(
"com.adjust.sdk:adjust-android:4.33.4"
)
// 最新版本
// 广告收入跟踪模块
// implementation("com.adjust.sdk:adjust-adrevenue:1.0.0")
// 需要集成的广告平台适配器(根据实际使用的平台选择)
// implementation 'com.adjust.sdk:adjust-adrevenue-applovin:1.0.0' // AppLovin
// implementation 'com.adjust.sdk:adjust-adrevenue-googleadmanager:1.0.0' // AdMob
// implementation("com.adjust.sdk:adjust-adrevenue-pangle:1.0.0") // 穿山甲
// implementation 'com.adjust.sdk:adjust-adrevenue-unity:1.0.0' // Unity Ads
}
}
\ No newline at end of file
app/libs/adapter/applovin-adapter-13.3.0.1.aar
0 → 100644
View file @
3644c834
File added
app/libs/adapter/bigo-adapter-5.3.0.2.aar
0 → 100644
View file @
3644c834
File added
app/libs/adapter/inmobi-adapter-10.8.3.1.aar
0 → 100644
View file @
3644c834
File added
app/libs/adapter/mintegral-adapter-16.9.71.1.aar
0 → 100644
View file @
3644c834
File added
app/libs/adapter/vungle-adapter-7.5.0.1.aar
0 → 100644
View file @
3644c834
File added
app/libs/open_ad_sdk_6.5.7.1.aar
0 → 100644
View file @
3644c834
File added
app/proguard-rules.pro
View file @
3644c834
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
-
keep
class
com
.
squareup
.
okhttp
.
**
{
*
;
}
-
keep
class
com
.
squareup
.
okhttp
.
**
{
*
;
}
-
keep
class
com
.
bytedance
.
sdk
.
**
{
*
;
}
# 保持 Facebook SDK 的类和方法
# 保持 Facebook SDK 的类和方法
-
keep
class
com
.
facebook
.
**
{
*
;
}
-
keep
class
com
.
facebook
.
**
{
*
;
}
...
@@ -64,4 +64,5 @@
...
@@ -64,4 +64,5 @@
# public static *** e(...);
# public static *** e(...);
#}
#}
-
keep
class
com
.
bytedance
.
sdk
.
**
{
*
;
}
#为避免在使用Proguard时混淆SDK代码,请确保将以下配置添加到Proguard.cfg文件或任何其他混淆文件的末尾:
\ No newline at end of file
-
keep
class
com
.
bytedance
.
sdk
.
**
{
*
;
}
app/src/main/AndroidManifest.xml
View file @
3644c834
...
@@ -41,19 +41,31 @@
...
@@ -41,19 +41,31 @@
android:theme=
"@style/Theme.AppTheme"
android:theme=
"@style/Theme.AppTheme"
tools:targetApi=
"31"
>
tools:targetApi=
"31"
>
<!-- <activity-->
<!-- android:name=".ui.splash.SplashActivity"-->
<!-- android:exported="true"-->
<!-- android:launchMode="singleTop"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/splash.theme"-->
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!---->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<activity
<activity
android:name=
".
ui.splash.Splash
Activity"
android:name=
".
business.pangle.Pangle
Activity"
android:exported=
"true"
android:exported=
"true"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:theme=
"@style/splash.theme"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
>
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
<activity
android:name=
".ui.main.MainActivity"
android:name=
".ui.main.MainActivity"
android:exported=
"true"
android:exported=
"true"
...
@@ -230,53 +242,54 @@
...
@@ -230,53 +242,54 @@
android:name=
"com.facebook.sdk.ApplicationId"
android:name=
"com.facebook.sdk.ApplicationId"
android:value=
"@string/facebook_app_id"
/>
android:value=
"@string/facebook_app_id"
/>
<activity
<!-- <activity-->
android:name=
".ui.guide2.GuideAc"
<!-- android:name=".ui.guide2.GuideAc"-->
android:exported=
"false"
<!-- android:exported="false"-->
android:screenOrientation=
"portrait"
<!-- android:screenOrientation="portrait"-->
android:theme=
"@style/Guide.Theme"
<!-- android:theme="@style/Guide.Theme"-->
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/
>
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" />--
>
<activity
<!-- <activity-->
android:name=
".ui.guide2.Guide2Ac"
<!-- android:name=".ui.guide2.Guide2Ac"-->
android:excludeFromRecents=
"true"
<!-- android:excludeFromRecents="true"-->
android:launchMode=
"singleTask"
<!-- android:launchMode="singleTask"-->
android:screenOrientation=
"portrait"
<!-- android:screenOrientation="portrait"-->
android:taskAffinity=
""
<!-- android:taskAffinity=""-->
android:theme=
"@style/Guide.Theme"
<!-- android:theme="@style/Guide.Theme"-->
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/
>
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" />--
>
<service
<!-- <service-->
android:name=
".ui.guide2.NotifyService"
<!-- android:name=".ui.guide2.NotifyService"-->
android:enabled=
"true"
<!-- android:enabled="true"-->
android:exported=
"false"
/>
<!-- android:exported="false" />-->
<!-- <activity-alias-->
<!-- android:name=".OtherAcAlias"-->
<!-- android:enabled="false"-->
<!-- android:exported="true"-->
<!-- android:icon="@mipmap/logo"-->
<!-- android:label="@string/app_name"-->
<!-- android:launchMode="singleTop"-->
<!-- android:roundIcon="@mipmap/logo"-->
<!-- android:targetActivity=".ui.splash.SplashActivity">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity-alias>-->
<!-- <activity-->
<!-- android:name=".ui.guide2.Guide0Activity"-->
<!-- android:enabled="false"-->
<!-- android:excludeFromRecents="true"-->
<!-- android:exported="true"-->
<!-- android:launchMode="singleTop"-->
<!-- android:noHistory="true"-->
<!-- android:theme="@style/Guide.Theme">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.INFO" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<activity-alias
android:name=
".OtherAcAlias"
android:enabled=
"false"
android:exported=
"true"
android:icon=
"@mipmap/logo"
android:label=
"@string/app_name"
android:launchMode=
"singleTop"
android:roundIcon=
"@mipmap/logo"
android:targetActivity=
".ui.splash.SplashActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity-alias>
<activity
android:name=
".ui.guide2.Guide0Activity"
android:enabled=
"false"
android:excludeFromRecents=
"true"
android:exported=
"true"
android:launchMode=
"singleTop"
android:noHistory=
"true"
android:theme=
"@style/Guide.Theme"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.INFO"
/>
</intent-filter>
</activity>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/base/appzxhy/MyApplication.kt
View file @
3644c834
...
@@ -36,6 +36,7 @@ import com.facebook.appevents.AppEventsLogger
...
@@ -36,6 +36,7 @@ import com.facebook.appevents.AppEventsLogger
import
com.base.appzxhy.business.push.receiver.AlarmReceiver.Companion.startAlarm
import
com.base.appzxhy.business.push.receiver.AlarmReceiver.Companion.startAlarm
import
com.base.appzxhy.business.push.timer.TimerManager.Companion.changeTimer
import
com.base.appzxhy.business.push.timer.TimerManager.Companion.changeTimer
import
com.base.appzxhy.business.push.work.RepeatingWorker.Companion.schedulePeriodicWork
import
com.base.appzxhy.business.push.work.RepeatingWorker.Companion.schedulePeriodicWork
import
com.bytedance.sdk.openadsdk.api.init.PAGConfig
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
...
@@ -71,7 +72,7 @@ class MyApplication : Application() {
...
@@ -71,7 +72,7 @@ class MyApplication : Application() {
initUUid
()
initUUid
()
initGid
()
initGid
()
initApp
()
initApp
()
initLifeListener
()
initLifeListener
()
initLanguage
()
initLanguage
()
}
}
...
@@ -125,6 +126,7 @@ class MyApplication : Application() {
...
@@ -125,6 +126,7 @@ class MyApplication : Application() {
fun
initApp
()
{
fun
initApp
()
{
//初始化广告相关业务
//初始化广告相关业务
AdsMgr
.
init
(
appContext
)
AdsMgr
.
init
(
appContext
)
...
...
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
View file @
3644c834
...
@@ -26,6 +26,7 @@ import com.base.appzxhy.bean.config.ConfigBean.Companion.configBean
...
@@ -26,6 +26,7 @@ import com.base.appzxhy.bean.config.ConfigBean.Companion.configBean
//import com.base.appzxhy.business.ads.applovin.MaxOpenMgr
//import com.base.appzxhy.business.ads.applovin.MaxOpenMgr
import
com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.business.pangle.PangleBannerMgr
import
com.base.appzxhy.business.pangle.PangleBannerMgr
import
com.base.appzxhy.business.pangle.PangleInit.initPangle
import
com.base.appzxhy.business.pangle.PangleInterMgr
import
com.base.appzxhy.business.pangle.PangleInterMgr
import
com.base.appzxhy.business.pangle.PangleOpenMgr
import
com.base.appzxhy.business.pangle.PangleOpenMgr
import
com.base.appzxhy.business.pangle.PangleRewardMgr
import
com.base.appzxhy.business.pangle.PangleRewardMgr
...
@@ -171,34 +172,6 @@ object AdsMgr {
...
@@ -171,34 +172,6 @@ object AdsMgr {
// }
// }
// var admobInitCallBack: (() -> Unit)? = null
// var admobInitCallBack: (() -> Unit)? = null
// var maxInitCallBack: (() -> Unit)? = null
private
fun
buildNewConfig
(
context
:
Context
):
PAGConfig
?
{
return
PAGConfig
.
Builder
()
.
appId
(
GlobalConfig
.
ID_PANGLE_APPLICATION
)
.
appIcon
(
R
.
mipmap
.
logo
)
.
debugLog
(
BuildConfig
.
DEBUG
)
.
supportMultiProcess
(
false
)
.
build
()
}
fun
initPangle
(
context
:
Context
,
next
:
((
isInit
:
Boolean
)
->
Unit
)?
=
null
)
{
val
pAGInitConfig
=
buildNewConfig
(
context
)
PAGSdk
.
init
(
context
,
pAGInitConfig
,
object
:
PAGInitCallback
{
override
fun
success
()
{
val
version
=
PAGSdk
.
getSDKVersion
()
val
isInitSuccess
=
PAGSdk
.
isInitSuccess
()
next
?.
invoke
(
isInitSuccess
)
//context.toast("pangle init success $version")
}
override
fun
fail
(
code
:
Int
,
msg
:
String
?)
{
next
?.
invoke
(
false
)
//context.toast("pangle init fail code=$code msg=$msg")
}
})
}
/**
/**
...
...
app/src/main/java/com/base/appzxhy/business/pangle/PangleActivity.kt
View file @
3644c834
...
@@ -11,6 +11,7 @@ import com.base.appzxhy.GlobalConfig
...
@@ -11,6 +11,7 @@ import com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.R
import
com.base.appzxhy.R
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.pangle.PangleInit.initPangle
import
com.base.appzxhy.databinding.ActivityPangleBinding
import
com.base.appzxhy.databinding.ActivityPangleBinding
import
com.base.appzxhy.ui.main.MainActivity
import
com.base.appzxhy.ui.main.MainActivity
...
@@ -29,13 +30,13 @@ class PangleActivity : AppCompatActivity() {
...
@@ -29,13 +30,13 @@ class PangleActivity : AppCompatActivity() {
}
}
binding
.
initSdk
.
setOnClickListener
{
binding
.
initSdk
.
setOnClickListener
{
AdsMgr
.
initPangle
(
this
)
initPangle
(
this
)
}
}
binding
.
showOpen
.
setOnClickListener
{
binding
.
showOpen
.
setOnClickListener
{
AdsMgr
.
showOpen
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
AdsMgr
.
showOpen
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
override
fun
next
()
{
this
@PangleActivity
.
startActivity
(
Intent
(
this
@PangleActivity
,
MainActivity
::
class
.
java
))
//
this@PangleActivity.startActivity(Intent(this@PangleActivity, MainActivity::class.java))
}
}
})
})
...
...
app/src/main/java/com/base/appzxhy/business/pangle/PangleEvent.kt
0 → 100644
View file @
3644c834
package
com.base.appzxhy.business.pangle
import
android.app.Activity
import
android.os.Bundle
import
com.adjust.sdk.Adjust
import
com.adjust.sdk.AdjustAdRevenue
import
com.adjust.sdk.AdjustConfig
import
com.base.appzxhy.MyApplication
import
com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.utils.AppPreferences
import
com.base.appzxhy.utils.LogEx
import
com.bytedance.sdk.openadsdk.api.PangleAd
import
com.facebook.appevents.AppEventsLogger
import
com.google.firebase.analytics.FirebaseAnalytics
import
com.google.firebase.analytics.ktx.analytics
import
com.google.firebase.ktx.Firebase
import
org.json.JSONObject
import
java.math.BigDecimal
import
java.util.Currency
var
pangeleCache
=
0.0f
get
()
{
return
AppPreferences
.
getInstance
().
getFloat
(
"pangeleCache"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"pangeleCache"
,
value
,
true
)
}
object
PangleEvent
{
private
val
TAG
=
"PangleEvent"
fun
eventPangleAd
(
ac
:
Activity
,
ad
:
PangleAd
)
{
val
showEcpm
=
ad
.
pagRevenueInfo
?.
showEcpm
showEcpm
?:
return
val
from
=
ac
.
javaClass
.
simpleName
val
adnName
=
showEcpm
.
adnName
//Price per thousand impressions, in cents,前次展示加个,美分单位
val
ecpm
=
showEcpm
.
cpm
//The currency of the CPM
val
currency
=
showEcpm
.
currency
//Pangle Placament ID
val
adUnit
=
showEcpm
.
adUnit
//Network Placement ID
val
placementId
=
showEcpm
.
placement
//Country of the ads
val
country
=
showEcpm
.
country
//Format of the ads
val
format
=
showEcpm
.
adFormat
//Whether is bidding or waterfall
val
biddingOrWaterfall
=
showEcpm
.
biddingType
//Price of the ad
val
price
=
showEcpm
.
revenue
//Precision of the ad
val
precision
=
showEcpm
.
precision
//Detailed segment ID of the ad
val
segmentId
=
showEcpm
.
segmentID
LogEx
.
logDebug
(
TAG
,
"from=$from ecpm=$ecpm currency=$currency ad_unit=$adUnit format=$format"
)
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"openAd"
)
obj
.
put
(
"valueMicros"
,
showEcpm
.
cpm
.
toDouble
()
*
10
)
obj
.
put
(
"currencyCode"
,
showEcpm
.
currency
)
obj
.
put
(
"precision"
,
showEcpm
.
precision
)
EventUtils
.
event
(
"ad_price"
,
ext
=
obj
)
val
adjustAdRevenue
=
AdjustAdRevenue
(
AdjustConfig
.
AD_REVENUE_SOURCE_PUBLISHER
)
//5965及以上请除以1000(美金),5964及以下请除以100000(美分)
adjustAdRevenue
.
setRevenue
(
showEcpm
.
cpm
.
toDouble
()
/
1000f
,
showEcpm
.
currency
)
//Optional
adjustAdRevenue
.
setAdRevenueNetwork
(
showEcpm
.
adnName
)
adjustAdRevenue
.
setAdRevenueUnit
(
showEcpm
.
adUnit
)
adjustAdRevenue
.
setAdRevenuePlacement
(
showEcpm
.
placement
)
Adjust
.
trackAdRevenue
(
adjustAdRevenue
)
//fb
val
fbLogger
=
AppEventsLogger
.
newLogger
(
MyApplication
.
Companion
.
appContext
)
fbLogger
.
logPurchase
(
BigDecimal
.
valueOf
(
showEcpm
.
cpm
.
toDouble
()
/
100000
),
Currency
.
getInstance
(
showEcpm
.
currency
))
//firebase
val
currentImpressionRevenue
=
showEcpm
.
cpm
.
toDouble
()
/
100000
Firebase
.
analytics
.
logEvent
(
"ad_price"
,
Bundle
().
apply
{
putDouble
(
"valueMicros"
,
currentImpressionRevenue
)
})
pangeleCache
=
pangeleCache
+
currentImpressionRevenue
.
toFloat
()
//上报Total_Ads_Revenue_001
if
(
pangeleCache
>=
0.01
)
{
//如果超过0.01就触发一次tROAS taichi事件
val
roasbundle
=
Bundle
()
roasbundle
.
putDouble
(
FirebaseAnalytics
.
Param
.
VALUE
,
currentImpressionRevenue
)
roasbundle
.
putString
(
FirebaseAnalytics
.
Param
.
CURRENCY
,
showEcpm
.
currency
)
Firebase
.
analytics
.
logEvent
(
"Total_Ads_Revenue_001"
,
roasbundle
)
pangeleCache
=
0.0f
//重新清零,开始计算
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/business/pangle/PangleInit.kt
0 → 100644
View file @
3644c834
package
com.base.appzxhy.business.pangle
import
android.content.Context
import
com.base.appzxhy.BuildConfig
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.R
import
com.bytedance.sdk.openadsdk.api.PAGConstant.PAGChildDirectedType
import
com.bytedance.sdk.openadsdk.api.PAGConstant.PAGDoNotSellType
import
com.bytedance.sdk.openadsdk.api.PAGConstant.PAGGDPRConsentType
import
com.bytedance.sdk.openadsdk.api.PAGConstant.PAGPAConsentType
import
com.bytedance.sdk.openadsdk.api.PAGUserInfoForSegment
import
com.bytedance.sdk.openadsdk.api.init.PAGConfig
import
com.bytedance.sdk.openadsdk.api.init.PAGSdk
import
com.bytedance.sdk.openadsdk.api.init.PAGSdk.PAGInitCallback
object
PangleInit
{
// var maxInitCallBack: (() -> Unit)? = null
private
fun
buildNewConfig
(
context
:
Context
):
PAGConfig
?
{
//根据穿山甲官方文档,准确设置用户属性可使eCPM提升15%-40%,但虚假信息将导致处罚
val
userInfo
=
PAGUserInfoForSegment
.
Builder
()
.
setAge
(
11
)
//年龄
.
setGender
(
PAGUserInfoForSegment
.
GENDER_MALE
)
//性别
.
setChannel
(
"pangle-mediation channel"
)
// 主渠道标识
.
setSubChannel
(
"pangle-mediation sub-channel"
)
//子渠道标识
.
setUserId
(
"12345"
)
//用户唯一id
.
setUserValueGroup
(
"pangle-mediation-group"
)
//用户价值分组(如付费用户分组)
.
setCustomInfos
(
HashMap
<
String
?,
String
?>())
//自定义扩展属性
.
build
()
return
PAGConfig
.
Builder
()
.
appId
(
GlobalConfig
.
ID_PANGLE_APPLICATION
)
.
appIcon
(
R
.
mipmap
.
logo
)
.
debugLog
(
BuildConfig
.
DEBUG
)
.
supportMultiProcess
(
false
)
//设置是否出售用户数据(CCPA 合规) 美国加州消费者隐私法案 (CCPA)
//PAG_DO_NOT_SELL_TYPE_DEFAULT 默认状态(SDK 自动处理)
//PAG_DO_NOT_SELL_TYPE_NOT_SELL 用户选择不出售数据
//PAG_DO_NOT_SELL_TYPE_SELL 用户允许出售数据
.
setDoNotSell
(
PAGDoNotSellType
.
PAG_DO_NOT_SELL_TYPE_DEFAULT
)
//标识应用是否面向儿童(COPPA 合规) 美国儿童在线隐私保护法 (COPPA)
//PAG_CHILD_DIRECTED_TYPE_DEFAULT 默认状态
//PAG_CHILD_DIRECTED_TYPE_CHILD 应用主要面向13岁以下儿童
//PAG_CHILD_DIRECTED_TYPE_NOT_CHILD 应用不面向儿童
.
setChildDirected
(
PAGChildDirectedType
.
PAG_CHILD_DIRECTED_TYPE_DEFAULT
)
//设置 GDPR 用户同意状态 欧盟通用数据保护条例 (GDPR)
//PAG_GDPR_CONSENT_TYPE_DEFAULT 默认状态(未明确同意)
//PAG_GDPR_CONSENT_TYPE_CONSENT 用户明确同意数据收集
//PAG_GDPR_CONSENT_TYPE_NO_CONSENT 用户拒绝数据收集
.
setGDPRConsent
(
PAGGDPRConsentType
.
PAG_GDPR_CONSENT_TYPE_DEFAULT
)
//设置用户是否同意接收个性化广告的方法,主要针对中国大陆地区的《个人信息保护法》
//PAG_PA_CONSENT_TYPE_CONSENT 用户同意个性化广告 投放个性化广告
//PAG_PA_CONSENT_TYPE_NO_CONSENT 用户拒绝个性化广告 仅投放通用广告
.
setPAConsent
(
PAGPAConsentType
.
PAG_PA_CONSENT_TYPE_CONSENT
)
//用户分组,不懂不用调
// .setConfigUserInfoForSegment(userInfo)
.
build
()
}
fun
initPangle
(
context
:
Context
,
next
:
((
isInit
:
Boolean
)
->
Unit
)?
=
null
)
{
//此方法一定要在初始化Pangle以及其他聚合之前调用
PAGConfig
.
setIsMediation
(
true
)
val
pAGInitConfig
=
buildNewConfig
(
context
)
PAGSdk
.
init
(
context
,
pAGInitConfig
,
object
:
PAGInitCallback
{
override
fun
success
()
{
val
version
=
PAGSdk
.
getSDKVersion
()
val
isInitSuccess
=
PAGSdk
.
isInitSuccess
()
next
?.
invoke
(
isInitSuccess
)
//context.toast("pangle init success $version")
}
override
fun
fail
(
code
:
Int
,
msg
:
String
?)
{
next
?.
invoke
(
false
)
//context.toast("pangle init fail code=$code msg=$msg")
}
})
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/business/pangle/PangleInterMgr.kt
View file @
3644c834
...
@@ -3,6 +3,7 @@ package com.base.appzxhy.business.pangle
...
@@ -3,6 +3,7 @@ package com.base.appzxhy.business.pangle
import
android.app.Activity
import
android.app.Activity
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.pangle.PangleEvent.eventPangleAd
import
com.base.appzxhy.utils.LogEx
import
com.base.appzxhy.utils.LogEx
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAd
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAd
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAdInteractionListener
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAdInteractionListener
...
@@ -70,6 +71,11 @@ class PangleInterMgr {
...
@@ -70,6 +71,11 @@ class PangleInterMgr {
interstitialAd
?.
setAdInteractionListener
(
object
:
PAGInterstitialAdInteractionListener
{
interstitialAd
?.
setAdInteractionListener
(
object
:
PAGInterstitialAdInteractionListener
{
override
fun
onAdShowed
()
{
override
fun
onAdShowed
()
{
showCallBack
?.
show
()
showCallBack
?.
show
()
interstitialAd
?.
let
{
eventPangleAd
(
ac
,
it
)
}
interstitialAd
=
null
interstitialAd
=
null
load
()
load
()
}
}
...
...
app/src/main/java/com/base/appzxhy/business/pangle/PangleOpenMgr.kt
View file @
3644c834
...
@@ -3,6 +3,7 @@ package com.base.appzxhy.business.pangle
...
@@ -3,6 +3,7 @@ package com.base.appzxhy.business.pangle
import
android.app.Activity
import
android.app.Activity
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.pangle.PangleEvent.eventPangleAd
import
com.base.appzxhy.utils.LogEx
import
com.base.appzxhy.utils.LogEx
import
com.bytedance.sdk.openadsdk.api.open.PAGAppOpenAd
import
com.bytedance.sdk.openadsdk.api.open.PAGAppOpenAd
import
com.bytedance.sdk.openadsdk.api.open.PAGAppOpenAdInteractionListener
import
com.bytedance.sdk.openadsdk.api.open.PAGAppOpenAdInteractionListener
...
@@ -72,6 +73,11 @@ class PangleOpenMgr {
...
@@ -72,6 +73,11 @@ class PangleOpenMgr {
ttAppOpenAd
?.
setAdInteractionListener
(
object
:
PAGAppOpenAdInteractionListener
{
ttAppOpenAd
?.
setAdInteractionListener
(
object
:
PAGAppOpenAdInteractionListener
{
override
fun
onAdShowed
()
{
override
fun
onAdShowed
()
{
showCallBack
?.
show
()
showCallBack
?.
show
()
ttAppOpenAd
?.
let
{
eventPangleAd
(
ac
,
it
)
}
ttAppOpenAd
=
null
ttAppOpenAd
=
null
load
()
load
()
}
}
...
...
app/src/main/java/com/base/appzxhy/ui/guide2/Guide2Ac.kt
View file @
3644c834
...
@@ -7,6 +7,7 @@ import com.base.appzxhy.MyApplication
...
@@ -7,6 +7,7 @@ import com.base.appzxhy.MyApplication
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.business.pangle.PangleInit.initPangle
import
com.base.appzxhy.databinding.ActivityGuideInfoBinding
import
com.base.appzxhy.databinding.ActivityGuideInfoBinding
import
com.base.appzxhy.utils.ActivityManagerUtils
import
com.base.appzxhy.utils.ActivityManagerUtils
...
@@ -21,7 +22,7 @@ class Guide2Ac : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding
...
@@ -21,7 +22,7 @@ class Guide2Ac : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding
}
}
Log
.
e
(
"tttttttttttttttttt"
,
"AdStart"
)
Log
.
e
(
"tttttttttttttttttt"
,
"AdStart"
)
AdsMgr
.
initPangle
(
MyApplication
.
appContext
)
{
initPangle
(
MyApplication
.
appContext
)
{
runOnUiThread
{
runOnUiThread
{
if
(
it
)
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
if
(
it
)
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
override
fun
next
()
{
...
...
app/src/main/java/com/base/appzxhy/ui/guide2/GuideAc.kt
View file @
3644c834
...
@@ -9,6 +9,7 @@ import androidx.core.view.postDelayed
...
@@ -9,6 +9,7 @@ import androidx.core.view.postDelayed
import
com.base.appzxhy.MyApplication
import
com.base.appzxhy.MyApplication
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.pangle.PangleInit.initPangle
import
com.base.appzxhy.databinding.ActivityGuideInfoBinding
import
com.base.appzxhy.databinding.ActivityGuideInfoBinding
/**
/**
...
@@ -27,7 +28,7 @@ class GuideAc : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding:
...
@@ -27,7 +28,7 @@ class GuideAc : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding:
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
}
}
AdsMgr
.
initPangle
(
MyApplication
.
appContext
)
initPangle
(
MyApplication
.
appContext
)
Log
.
e
(
"tttttttttttttttttt"
,
"OverLayStart"
)
Log
.
e
(
"tttttttttttttttttt"
,
"OverLayStart"
)
binding
.
root
.
postDelayed
(
2000
)
{
binding
.
root
.
postDelayed
(
2000
)
{
ComponentUtil
.
setComponentEnabled
(
ComponentUtil
.
setComponentEnabled
(
...
...
app/src/main/res/raw/keep.xml
0 → 100644
View file @
3644c834
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
tools:keep=
"@layout/tt_*,
@layout/notification_*,
@anim/tt_*,
@drawable/tt_*,
@string/tt_*,
@color/tt_*,
@string/ad*,
@string/star_*,
@dimen/tt_*,
@integer/tt_*,
@style/tt_*,
@style/Theme.Dialog.TT_*,
@style/tt_*,
@style/quick_*,
@style/EditTextStyle*,
@attr/tt_*"
/>
\ No newline at end of file
settings.gradle.kts
View file @
3644c834
...
@@ -24,6 +24,7 @@ dependencyResolutionManagement {
...
@@ -24,6 +24,7 @@ dependencyResolutionManagement {
google
()
google
()
mavenCentral
()
mavenCentral
()
//pangle的广告库
maven
(
"https://artifact.bytedance.com/repository/pangle"
)
maven
(
"https://artifact.bytedance.com/repository/pangle"
)
maven
(
"https://s01.oss.sonatype.org/content/groups/public"
)
maven
(
"https://s01.oss.sonatype.org/content/groups/public"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment