Commit bda8fbadaf48df9db7060a6330ec0e3bfe72dfcb
1 parent
3ba925a9
feat:集成友盟APM
Showing
1 changed file
with
24 additions
and
3 deletions
android/app/src/main/kotlin/com/kouyuxingqiu/wow_english/MainActivity.kt
@@ -12,6 +12,8 @@ import com.kouyuxingqiu.wow_english.methodChannels.GameMethodChannel | @@ -12,6 +12,8 @@ import com.kouyuxingqiu.wow_english.methodChannels.GameMethodChannel | ||
12 | import com.kouyuxingqiu.wow_english.methodChannels.SingSoungMethodChannel | 12 | import com.kouyuxingqiu.wow_english.methodChannels.SingSoungMethodChannel |
13 | import com.umeng.commonsdk.UMConfigure | 13 | import com.umeng.commonsdk.UMConfigure |
14 | import io.flutter.embedding.android.FlutterActivity | 14 | import io.flutter.embedding.android.FlutterActivity |
15 | +import com.umeng.umcrash.UMCrash | ||
16 | + | ||
15 | 17 | ||
16 | class MainActivity : FlutterActivity() { | 18 | class MainActivity : FlutterActivity() { |
17 | override fun onCreate(savedInstanceState: Bundle?) { | 19 | override fun onCreate(savedInstanceState: Bundle?) { |
@@ -23,9 +25,7 @@ class MainActivity : FlutterActivity() { | @@ -23,9 +25,7 @@ class MainActivity : FlutterActivity() { | ||
23 | SingSoungMethodChannel(this, it) | 25 | SingSoungMethodChannel(this, it) |
24 | GameMethodChannel(this, it) | 26 | GameMethodChannel(this, it) |
25 | } | 27 | } |
26 | - //UM日志打印 | ||
27 | - UMConfigure.setLogEnabled(true) | ||
28 | - UMConfigure.preInit(this, "663b66b0b3362515012f4ea5", "official") | 28 | + initUmeng() |
29 | } | 29 | } |
30 | 30 | ||
31 | override fun onResume() { | 31 | override fun onResume() { |
@@ -56,4 +56,25 @@ class MainActivity : FlutterActivity() { | @@ -56,4 +56,25 @@ class MainActivity : FlutterActivity() { | ||
56 | // 打开沉浸式 | 56 | // 打开沉浸式 |
57 | WindowCompat.setDecorFitsSystemWindows(window, false)*/ | 57 | WindowCompat.setDecorFitsSystemWindows(window, false)*/ |
58 | } | 58 | } |
59 | + | ||
60 | + /** | ||
61 | + * 友盟初始化 | ||
62 | + */ | ||
63 | + private fun initUmeng() { | ||
64 | + // 在application.onCreate内配置各模块开关并预初始化SDK | ||
65 | + // 重点关注:如果您还想采集Native 崩溃、ANR等日志可以参考下面设置 | ||
66 | + UMCrash.initConfig(Bundle().apply { | ||
67 | + putBoolean(UMCrash.KEY_ENABLE_CRASH_JAVA, true) | ||
68 | + putBoolean(UMCrash.KEY_ENABLE_CRASH_NATIVE, true) | ||
69 | + putBoolean(UMCrash.KEY_ENABLE_ANR, true) | ||
70 | + putBoolean(UMCrash.KEY_ENABLE_PA, false) | ||
71 | + putBoolean(UMCrash.KEY_ENABLE_LAUNCH, false) | ||
72 | + putBoolean(UMCrash.KEY_ENABLE_MEM, false) | ||
73 | + putBoolean(UMCrash.KEY_ENABLE_H5PAGE, false) | ||
74 | + putBoolean(UMCrash.KEY_ENABLE_POWER, false) | ||
75 | + }) | ||
76 | + //UM日志打印 | ||
77 | + UMConfigure.setLogEnabled(true) | ||
78 | + UMConfigure.preInit(this, "663b66b0b3362515012f4ea5", "official") | ||
79 | + } | ||
59 | } | 80 | } |