Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
6fcc2e4d
Commit
6fcc2e4d
authored
Jul 24, 2024
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加广告配置
parent
bb4e39b6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
44 deletions
+108
-44
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+49
-28
NewSplashActivity.kt
...easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
+30
-10
ConfigBean.kt
...ain/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
+1
-0
ComUtils.kt
...main/java/com/test/easy/easycleanerjunk/helps/ComUtils.kt
+2
-0
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+8
-1
InstallHelps.kt
.../java/com/test/easy/easycleanerjunk/helps/InstallHelps.kt
+18
-5
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
6fcc2e4d
...
...
@@ -5,10 +5,10 @@ import android.app.Activity
import
android.content.Intent
import
android.os.Bundle
import
android.text.TextUtils
import
android.util.Log
import
com.applovin.sdk.AppLovinMediationProvider
import
com.applovin.sdk.AppLovinSdk
import
com.applovin.sdk.AppLovinSdkInitializationConfiguration
import
com.google.android.gms.ads.MobileAds
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.fcm.ActionBroadcast
import
com.test.easy.easycleanerjunk.fcm.FCMUtil
...
...
@@ -16,6 +16,7 @@ import com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.BlackUtils
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.InstallHelps
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
...
...
@@ -47,11 +48,8 @@ class MyApplication : BaseApplication() {
fun
initApp
()
{
initNotificationWork
()
InstallHelps
.
init
()
BlackUtils
.
requestBlack
()
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
// MobileAds.initialize(this) { initializationStatus ->
// }
InstallHelps
.
init
{
if
(
ConfigHelper
.
admobTrueMaxFlase
==
0
)
{
val
executor
=
Executors
.
newSingleThreadExecutor
()
executor
.
execute
{
val
initConfigBuilder
=
AppLovinSdkInitializationConfiguration
.
builder
(
...
...
@@ -64,11 +62,18 @@ class MyApplication : BaseApplication() {
// }
val
initConfig
=
initConfigBuilder
.
build
()
// Initialize the SDK with the configuration
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfig
)
{
sdkConfig
->
Log
.
e
(
"MXL"
,
"initApp: "
+
"广告初始化成功"
)
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfig
)
{
}
executor
.
shutdown
()
}
}
else
{
MobileAds
.
initialize
(
this
)
{
}
}
}
BlackUtils
.
requestBlack
()
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
}
initLifeListener
()
}
...
...
@@ -104,6 +109,7 @@ class MyApplication : BaseApplication() {
}
if
(
flag
)
{
if
(
ConfigHelper
.
admobTrueMaxFlase
==
0
){
if
(
MaxAdUtils
.
isOpenAdLoaded
())
{
MaxAdUtils
.
showAppOpenAd
(
activity
)
}
else
{
...
...
@@ -116,6 +122,21 @@ class MyApplication : BaseApplication() {
putExtra
(
"type"
,
-
1
)
})
}
}
else
{
if
(
AdmobUtils
.
isOpenAdLoaded
())
{
AdmobUtils
.
showAppOpenAd
(
activity
)
}
else
{
topActivity
?.
startActivity
(
Intent
(
topActivity
,
NewSplashActivity
::
class
.
java
).
apply
{
putExtra
(
"isHotLaunch"
,
true
)
putExtra
(
"type"
,
-
1
)
})
}
}
}
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
View file @
6fcc2e4d
...
...
@@ -14,6 +14,7 @@ import com.test.easy.easycleanerjunk.fcm.NotificationUtil
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService.Companion.startNotification
import
com.test.easy.easycleanerjunk.utils.BarUtils
...
...
@@ -86,6 +87,7 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
}
private
fun
loadAd
()
{
if
(
ConfigHelper
.
admobTrueMaxFlase
==
0
){
MaxAdUtils
.
loadAppOpenAd
{
if
(
isFinishing
||
isDestroyed
)
{
return
@loadAppOpenAd
...
...
@@ -101,6 +103,24 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
}
}
MaxAdUtils
.
loadInterstitialAd
(
this
)
}
else
{
AdmobUtils
.
loadAppOpenAd
{
if
(
isFinishing
||
isDestroyed
)
{
return
@loadAppOpenAd
}
else
{
if
(!
isPause
)
{
mProgressManager
?.
pauseProgress
()
runOnUiThread
{
AdmobUtils
.
showAppOpenAd
(
this
@NewSplashActivity
)
{
mProgressManager
?.
maxProgress
()
}
}
}
}
}
AdmobUtils
.
loadInterstitialAd
(
this
)
}
}
override
fun
onNewIntent
(
intent
:
Intent
)
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
View file @
6fcc2e4d
...
...
@@ -23,5 +23,6 @@ class ConfigBean() {
var
outcomeReturnHomeCount
:
Int
=
0
//返回主页弹几次
var
dayoutcomeHomePage
:
Int
=
0
//第二次打开到首页开关
var
maxShowNotificationCount
:
Int
=
0
var
admobTrueMaxFlase
:
Int
=
0
}
app/src/main/java/com/test/easy/easycleanerjunk/helps/ComUtils.kt
View file @
6fcc2e4d
...
...
@@ -70,6 +70,8 @@ object ComUtils {
SPUtils
.
getInstance
().
put
(
"outcomeReturnCount"
,
bean
.
outcomeReturnCount
)
SPUtils
.
getInstance
().
put
(
"outcomeReturnHomeCount"
,
bean
.
outcomeReturnHomeCount
)
SPUtils
.
getInstance
().
put
(
"dayoutcomeHomePage"
,
bean
.
dayoutcomeHomePage
)
SPUtils
.
getInstance
().
put
(
"maxShowNotificationCount"
,
bean
.
maxShowNotificationCount
)
ConfigHelper
.
admobTrueMaxFlase
=
bean
.
admobTrueMaxFlase
adDisplayInterval
=
bean
.
adInterval
maxMultiClick
=
bean
.
maxMultiClick
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
bean
.
adShowCount
)
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
6fcc2e4d
...
...
@@ -116,5 +116,12 @@ object ConfigHelper {
// SPUtils.getInstance().put("isfirstInstall", value, true)
// }
var
admobTrueMaxFlase
=
0
get
()
{
return
SPUtils
.
getInstance
().
getInt
(
"admobTrueMaxFlase"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"admobTrueMaxFlase"
,
value
,
true
)
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/helps/InstallHelps.kt
View file @
6fcc2e4d
...
...
@@ -7,7 +7,7 @@ import com.test.easy.easycleanerjunk.utils.SPUtils
import
org.json.JSONObject
object
InstallHelps
{
fun
init
()
{
fun
init
(
callback
:
()
->
Unit
)
{
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
...
...
@@ -22,7 +22,12 @@ object InstallHelps {
obj
.
put
(
"appInstallTime"
,
response
.
installBeginTimestampSeconds
)
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
EventUtils
.
event
(
"install_referrer"
,
ext
=
obj
,
isSingleEvent
=
true
)
if
(
listOf
(
"gclid"
,
"facebook"
,
"instagram"
).
all
{
!
installInfo
.
contains
(
it
,
true
)
})
{
if
(
listOf
(
"gclid"
,
"facebook"
,
"instagram"
).
all
{
!
installInfo
.
contains
(
it
,
true
)
}
)
{
//自然用户
SPUtils
.
getInstance
().
put
(
"install_source"
,
"origin"
)
}
else
{
...
...
@@ -30,28 +35,36 @@ object InstallHelps {
SPUtils
.
getInstance
().
put
(
"install_source"
,
"channel"
)
}
ComUtils
.
requestCfg
{
callback
.
invoke
()
val
timerS
=
SPUtils
.
getInstance
().
getInt
(
"timerS"
,
1
)
if
(
timerS
==
1
)
{
val
timerDelay
=
SPUtils
.
getInstance
().
getInt
(
"timerDelay"
,
1
)
val
timerInterval
=
SPUtils
.
getInstance
().
getInt
(
"timerInterval"
,
5
)
val
timerInterval
=
SPUtils
.
getInstance
().
getInt
(
"timerInterval"
,
5
)
MyTimerManager
.
getInstance
()
.
startTimer
((
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
())
.
startTimer
(
(
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
()
)
}
}
}
else
->
{
EventUtils
.
event
(
"install_referrer_error"
)
callback
.
invoke
()
}
}
}
catch
(
_
:
Exception
)
{
EventUtils
.
event
(
"install_referrer_error"
)
callback
.
invoke
()
}
}
override
fun
onInstallReferrerServiceDisconnected
()
{
callback
.
invoke
()
}
})
}
...
...
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