Commit a1b57838 authored by wanglei's avatar wanglei

...

parent 98b90e11
...@@ -52,6 +52,7 @@ class MyApplication : BaseApplication() { ...@@ -52,6 +52,7 @@ class MyApplication : BaseApplication() {
fun initApp(isFirst: Boolean = false) { fun initApp(isFirst: Boolean = false) {
if (!isFirst) { if (!isFirst) {
@Suppress("DEPRECATION")
FacebookSdk.sdkInitialize(applicationContext) FacebookSdk.sdkInitialize(applicationContext)
// FacebookSdk.setIsDebugEnabled(true) // FacebookSdk.setIsDebugEnabled(true)
// FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS) // FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
......
...@@ -4,9 +4,13 @@ import android.content.SharedPreferences; ...@@ -4,9 +4,13 @@ import android.content.SharedPreferences;
import android.util.Log; import android.util.Log;
import com.base.datarecovery.BuildConfig; import com.base.datarecovery.BuildConfig;
import com.base.datarecovery.MyApplication;
import com.base.datarecovery.help.BaseApplication; import com.base.datarecovery.help.BaseApplication;
import com.base.datarecovery.utils.AppPreferences;
import com.base.datarecovery.utils.EventUtils; import com.base.datarecovery.utils.EventUtils;
import com.base.datarecovery.utils.LogEx; import com.base.datarecovery.utils.LogEx;
import com.facebook.appevents.AppEventsLogger;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -145,6 +149,12 @@ public class AdDisplayUtils { ...@@ -145,6 +149,12 @@ public class AdDisplayUtils {
adDisplayCount = 0; adDisplayCount = 0;
} }
adDisplayCount++; adDisplayCount++;
int max = AppPreferences.getInstance().getInt("facebookAdShowEventCount", 3);
if (adClickCount >= max && max != -1) {
AppEventsLogger logger = AppEventsLogger.newLogger(MyApplication.context);
logger.logEvent("ad_show");
AppPreferences.getInstance().put("facebookAdShowEventCount", -1);
}
saveAdDisplayCount(); saveAdDisplayCount();
} }
......
...@@ -4,6 +4,8 @@ import android.app.Activity ...@@ -4,6 +4,8 @@ import android.app.Activity
import android.os.Bundle import android.os.Bundle
import com.base.datarecovery.help.BaseApplication import com.base.datarecovery.help.BaseApplication
import com.base.datarecovery.utils.EventUtils import com.base.datarecovery.utils.EventUtils
import com.facebook.appevents.AppEventsConstants
import com.facebook.appevents.AppEventsLogger
import com.google.android.gms.ads.AdValue import com.google.android.gms.ads.AdValue
import com.google.android.gms.ads.OnPaidEventListener import com.google.android.gms.ads.OnPaidEventListener
import com.google.android.gms.ads.ResponseInfo import com.google.android.gms.ads.ResponseInfo
...@@ -99,6 +101,11 @@ object AdmobEvent { ...@@ -99,6 +101,11 @@ object AdmobEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD") roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")
Firebase.analytics.logEvent("Total_Ads_Revenue_001", roasbundle) Firebase.analytics.logEvent("Total_Ads_Revenue_001", roasbundle)
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算 taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算
val logger = AppEventsLogger.newLogger(BaseApplication.context)
val parameters = Bundle()
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD")
logger.logEvent("ad_value", currentTaichiTroasCache.toDouble(), parameters)
} else { } else {
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", currentTaichiTroasCache) taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", currentTaichiTroasCache)
} }
......
...@@ -8,6 +8,8 @@ import com.base.datarecovery.help.BaseApplication ...@@ -8,6 +8,8 @@ import com.base.datarecovery.help.BaseApplication
import com.base.datarecovery.utils.EventUtils import com.base.datarecovery.utils.EventUtils
import com.base.datarecovery.utils.LogEx import com.base.datarecovery.utils.LogEx
import com.facebook.FacebookSdk import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsConstants
import com.facebook.appevents.AppEventsLogger
import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.FirebaseAnalytics
import org.json.JSONObject import org.json.JSONObject
...@@ -111,6 +113,11 @@ object AdMaxEvent { ...@@ -111,6 +113,11 @@ object AdMaxEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")///(Required)tROAS事件必须 roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")///(Required)tROAS事件必须
mFirebaseAnalytics.logEvent("Total_Ads_Revenue_001", roasbundle) // 给Taichi用 mFirebaseAnalytics.logEvent("Total_Ads_Revenue_001", roasbundle) // 给Taichi用
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算 taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算
val logger = AppEventsLogger.newLogger(BaseApplication.context)
val parameters = Bundle()
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD")
logger.logEvent("ad_value", currentTaichiTroasCache, parameters)
} else { } else {
taichiSharedPreferencesEditor.putFloat( taichiSharedPreferencesEditor.putFloat(
"TaichiTroasCache", "TaichiTroasCache",
......
...@@ -21,7 +21,7 @@ object RateStarPop { ...@@ -21,7 +21,7 @@ object RateStarPop {
if (AppPreferences.getInstance().getBoolean("isRated", false)) { if (AppPreferences.getInstance().getBoolean("isRated", false)) {
return return
} }
if (n > 0 && n % 2 == 0) { if (n > 0 && n % 3 == 0) {
} else { } else {
return return
......
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