Commit ed3ec34e authored by wanglei's avatar wanglei

...

parent 47a0509e
......@@ -256,7 +256,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
val delayTime = 450L
delay(delayTime)
processTime += delayTime
if (processTime >= Random.nextLong(3000, 4000)) {
if (processTime >= Random.nextLong(2500, 3000)) {
if (!outTimeAdStart) {
outTimeAdStart = true
outTimeAd()
......@@ -275,7 +275,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
}) {
val sp = AppPreferences.getInstance().getString("splashShowInter", "0").toInt()
if (sp == 1 && !loaded) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this,false) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this, false) {
binding.pb.progress = 100
jumpNext()
}
......
......@@ -67,7 +67,11 @@ object AdmobOpenUtils {
}
fun showAppOpenAd(activity: Activity, showBefore: ((flag: Boolean) -> Unit)? = null, onHidden: ((where: Int) -> Unit)? = null) {
fun showAppOpenAd(
activity: Activity,
isRetry: Boolean = false,
showBefore: ((flag: Boolean) -> Unit)? = null, onHidden: ((where: Int) -> Unit)? = null
) {
if (activity.isFinishing || activity.isDestroyed) {
return
......@@ -76,9 +80,6 @@ object AdmobOpenUtils {
onHidden?.invoke(1)
return
}
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
if (System.currentTimeMillis() - openLoadTime > 1000 * 60 * 60) {
LogEx.logDebug(TAG, "openLoadTime out time")
mOpenAd = null
......@@ -89,6 +90,11 @@ object AdmobOpenUtils {
EventUtils.event("ad_expire", ext = obj2)
return
}
if (!isRetry) {
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
}
if (mOpenAd != null) {
LogEx.logDebug(TAG, "mOpenAd!=null")
......@@ -124,12 +130,24 @@ object AdmobOpenUtils {
thisMOpenAd?.show(activity)
} else {
LogEx.logDebug(TAG, "mOpenAd=null")
onHidden?.invoke(5)
loadAppOpenAd()
val obj = JSONObject()
obj.put("reason", "no_ad")
obj.put("ad_unit", "openAd")
EventUtils.event("ad_show_error", ext = obj)
// onHidden?.invoke(5)
// loadAppOpenAd()
// val obj = JSONObject()
// obj.put("reason", "no_ad")
// obj.put("ad_unit", "openAd")
// EventUtils.event("ad_show_error", ext = obj)
loadAppOpenAd {
if (mOpenAd != null) {
showAppOpenAd(activity, true, showBefore, onHidden)
} else {
val obj = JSONObject()
obj.put("reason", "no_ad")
obj.put("ad_unit", "openAd")
EventUtils.event("ad_show_error", ext = obj)
onHidden?.invoke(5)
}
}
}
}
}
\ No newline at end of file
......@@ -19,11 +19,9 @@ public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
updateSharedPreferences(remoteMessage.getData());
manageTimerBasedOnMessage(remoteMessage.getData());
// updateSharedPreferences(remoteMessage.getData());
// manageTimerBasedOnMessage(remoteMessage.getData());
LogEx.INSTANCE.logDebug(TAG,"onMessageReceived",false);
AdDisplayUtils.getInstance().setMaxAdDisplayCount(Integer.valueOf(AppPreferences.getInstance().getString("adShowCount","45")));
AdDisplayUtils.getInstance().setMaxAdClickCount(Integer.valueOf(AppPreferences.getInstance().getString("adClickCount","10")));
EventUtils.INSTANCE.event("FCM_Received",null,null,false);
sendLocalNotification();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment