Commit 35d510ce authored by wanglei's avatar wanglei

...

parent fec216d4
......@@ -17,6 +17,8 @@ import com.base.filerecoveryrecyclebin.utils.ActivityManagerUtils
import com.base.filerecoveryrecyclebin.utils.AppPreferences
import com.base.filerecoveryrecyclebin.utils.InstallHelps
import com.base.filerecoveryrecyclebin.utils.LogEx
import com.facebook.FacebookSdk
import com.facebook.LoggingBehavior
import com.google.android.gms.ads.identifier.AdvertisingIdClient
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
......@@ -53,6 +55,10 @@ class MyApplication : BaseApplication() {
fun initApp(isStartClick: Boolean = false) {
if (!isStartClick) {
@Suppress("DEPRECATION")
FacebookSdk.sdkInitialize(applicationContext)
FacebookSdk.setIsDebugEnabled(true)
FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
val topic = ConfigHelper.packageName + "_push"
LogEx.logDebug(TAG, "topic=${topic}")
FCMManager.initFirebase(this)
......
......@@ -21,12 +21,14 @@ import com.base.filerecoveryrecyclebin.help.FileHelp
import com.base.filerecoveryrecyclebin.help.MediaStoreHelp.getImageMedia
import com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import com.base.filerecoveryrecyclebin.service.StayNotificationService
import com.base.filerecoveryrecyclebin.utils.AppPreferences
import com.base.filerecoveryrecyclebin.utils.BarUtils
import com.base.filerecoveryrecyclebin.utils.FileHexEx
import com.base.filerecoveryrecyclebin.utils.LogEx
import com.base.filerecoveryrecyclebin.view.DialogViews.showExitDialog
import com.base.filerecoveryrecyclebin.view.PermissionDialog.showPermissionBottomSheet
import com.base.filerecoveryrecyclebin.view.RateStarPop.showRateStarPopDialog
import com.facebook.appevents.AppEventsLogger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
......@@ -101,6 +103,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
}
val fbhome = AppPreferences.getInstance().getInt("fb_home", 0)
if (fbhome == 0) {
val logger = AppEventsLogger.newLogger(this)
logger.logEvent("home")
AppPreferences.getInstance().put("fb_home", 1)
}
}
......
......@@ -5,10 +5,12 @@ import android.content.SharedPreferences;
import android.util.Log;
import com.base.filerecoveryrecyclebin.BuildConfig;
import com.base.filerecoveryrecyclebin.MyApplication;
import com.base.filerecoveryrecyclebin.help.BaseApplication;
import com.base.filerecoveryrecyclebin.utils.AppPreferences;
import com.base.filerecoveryrecyclebin.utils.EventUtils;
import com.base.filerecoveryrecyclebin.utils.LogEx;
import com.facebook.appevents.AppEventsLogger;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -210,6 +212,15 @@ public class AdDisplayUtils {
adDisplayCount = 0;
}
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();
}
......
......@@ -4,6 +4,8 @@ import android.app.Activity
import android.os.Bundle
import com.base.filerecoveryrecyclebin.help.BaseApplication
import com.base.filerecoveryrecyclebin.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.OnPaidEventListener
import com.google.android.gms.ads.ResponseInfo
......@@ -98,6 +100,11 @@ object AdmobEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")
Firebase.analytics.logEvent("Total_Ads_Revenue_001", roasbundle)
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 {
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", currentTaichiTroasCache)
}
......
......@@ -8,6 +8,8 @@ import com.base.filerecoveryrecyclebin.help.BaseApplication
import com.base.filerecoveryrecyclebin.utils.EventUtils
import com.base.filerecoveryrecyclebin.utils.LogEx
import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsConstants
import com.facebook.appevents.AppEventsLogger
import com.google.firebase.analytics.FirebaseAnalytics
import org.json.JSONObject
......@@ -107,6 +109,11 @@ object AdMaxEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")///(Required)tROAS事件必须
mFirebaseAnalytics.logEvent("Total_Ads_Revenue_001", roasbundle) // 给Taichi用
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 {
taichiSharedPreferencesEditor.putFloat(
"TaichiTroasCache",
......
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