Commit ed3ec34e authored by wanglei's avatar wanglei

...

parent 47a0509e
...@@ -256,7 +256,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() { ...@@ -256,7 +256,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
val delayTime = 450L val delayTime = 450L
delay(delayTime) delay(delayTime)
processTime += delayTime processTime += delayTime
if (processTime >= Random.nextLong(3000, 4000)) { if (processTime >= Random.nextLong(2500, 3000)) {
if (!outTimeAdStart) { if (!outTimeAdStart) {
outTimeAdStart = true outTimeAdStart = true
outTimeAd() outTimeAd()
...@@ -275,7 +275,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() { ...@@ -275,7 +275,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
}) { }) {
val sp = AppPreferences.getInstance().getString("splashShowInter", "0").toInt() val sp = AppPreferences.getInstance().getString("splashShowInter", "0").toInt()
if (sp == 1 && !loaded) { if (sp == 1 && !loaded) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this,false) { AdmobMaxHelper.admobMaxShowInterstitialAd(this, false) {
binding.pb.progress = 100 binding.pb.progress = 100
jumpNext() jumpNext()
} }
......
...@@ -67,7 +67,11 @@ object AdmobOpenUtils { ...@@ -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) { if (activity.isFinishing || activity.isDestroyed) {
return return
...@@ -76,9 +80,6 @@ object AdmobOpenUtils { ...@@ -76,9 +80,6 @@ object AdmobOpenUtils {
onHidden?.invoke(1) onHidden?.invoke(1)
return return
} }
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
if (System.currentTimeMillis() - openLoadTime > 1000 * 60 * 60) { if (System.currentTimeMillis() - openLoadTime > 1000 * 60 * 60) {
LogEx.logDebug(TAG, "openLoadTime out time") LogEx.logDebug(TAG, "openLoadTime out time")
mOpenAd = null mOpenAd = null
...@@ -89,6 +90,11 @@ object AdmobOpenUtils { ...@@ -89,6 +90,11 @@ object AdmobOpenUtils {
EventUtils.event("ad_expire", ext = obj2) EventUtils.event("ad_expire", ext = obj2)
return return
} }
if (!isRetry) {
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
}
if (mOpenAd != null) { if (mOpenAd != null) {
LogEx.logDebug(TAG, "mOpenAd!=null") LogEx.logDebug(TAG, "mOpenAd!=null")
...@@ -124,12 +130,24 @@ object AdmobOpenUtils { ...@@ -124,12 +130,24 @@ object AdmobOpenUtils {
thisMOpenAd?.show(activity) thisMOpenAd?.show(activity)
} else { } else {
LogEx.logDebug(TAG, "mOpenAd=null") LogEx.logDebug(TAG, "mOpenAd=null")
onHidden?.invoke(5) // onHidden?.invoke(5)
loadAppOpenAd() // loadAppOpenAd()
val obj = JSONObject() // val obj = JSONObject()
obj.put("reason", "no_ad") // obj.put("reason", "no_ad")
obj.put("ad_unit", "openAd") // obj.put("ad_unit", "openAd")
EventUtils.event("ad_show_error", ext = obj) // 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 { ...@@ -19,11 +19,9 @@ public class MessagingService extends FirebaseMessagingService {
@Override @Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage); super.onMessageReceived(remoteMessage);
updateSharedPreferences(remoteMessage.getData()); // updateSharedPreferences(remoteMessage.getData());
manageTimerBasedOnMessage(remoteMessage.getData()); // manageTimerBasedOnMessage(remoteMessage.getData());
LogEx.INSTANCE.logDebug(TAG,"onMessageReceived",false); 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); EventUtils.INSTANCE.event("FCM_Received",null,null,false);
sendLocalNotification(); 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