44import android .app .ActivityManager ;
55import android .app .Application ;
66import android .content .Context ;
7+ import android .util .Log ;
78
89import java .util .ArrayList ;
9- import java .util .Collections ;
1010import java .util .List ;
1111
1212import cn .hikyson .android .godeye .okhttp .GodEyePluginOkNetwork ;
13- import cn .hikyson .godeye .core .GodEye ;
14- import cn .hikyson .godeye .core .GodEyeConfig ;
15- import cn .hikyson .godeye .monitor .GodEyeMonitor ;
16- import cn .hikyson .godeye .monitor .modules .appinfo .AppInfoLabel ;
13+ import cn .hikyson .godeye .core .GodEyeHelper ;
14+ import cn .hikyson .godeye .core .monitor .AppInfoConext ;
15+ import cn .hikyson .godeye .core .monitor .AppInfoLabel ;
1716import okhttp3 .OkHttpClient ;
1817
19- import static cn .hikyson .godeye .core .utils .ProcessUtils .isMainProcess ;
20-
2118/**
2219 * Created by kysonchao on 2018/1/29.
2320 */
@@ -27,22 +24,18 @@ public class MyApp extends Application {
2724 @ Override
2825 public void onCreate () {
2926 super .onCreate ();
30- if (isMainProcess (this )) {
31- GodEye .instance ().install (GodEyeConfig .fromAssets ("android-godeye-config/install.config" ));
32- GodEyeMonitor .injectAppInfoConext (new GodEyeMonitor .AppInfoConext () {
33- @ Override
34- public List <AppInfoLabel > getAppInfo () {
35- List <AppInfoLabel > appInfoLabels = new ArrayList <>();
36- appInfoLabels .add (new AppInfoLabel ("ApplicationID" , BuildConfig .APPLICATION_ID , null ));
37- appInfoLabels .add (new AppInfoLabel ("VersionName" , BuildConfig .VERSION_NAME , "" ));
38- appInfoLabels .add (new AppInfoLabel ("VersionCode" , String .valueOf (BuildConfig .VERSION_CODE ), "" ));
39- appInfoLabels .add (new AppInfoLabel ("BuildType" , BuildConfig .BUILD_TYPE , "" ));
40- appInfoLabels .add (new AppInfoLabel ("AndroidGodEye" , "https://github.com/Kyson/AndroidGodEye" , "https://github.com/Kyson/AndroidGodEye" ));
41- return appInfoLabels ;
42- }
43- });
44- GodEyeMonitor .work (this );
45- }
27+ GodEyeHelper .setMonitorAppInfoConext (new AppInfoConext () {
28+ @ Override
29+ public List <cn .hikyson .godeye .core .monitor .AppInfoLabel > getAppInfo () {
30+ List <AppInfoLabel > appInfoLabels = new ArrayList <>();
31+ appInfoLabels .add (new AppInfoLabel ("ApplicationID" , BuildConfig .APPLICATION_ID , null ));
32+ appInfoLabels .add (new AppInfoLabel ("VersionName" , BuildConfig .VERSION_NAME , "" ));
33+ appInfoLabels .add (new AppInfoLabel ("VersionCode" , String .valueOf (BuildConfig .VERSION_CODE ), "" ));
34+ appInfoLabels .add (new AppInfoLabel ("BuildType" , BuildConfig .BUILD_TYPE , "" ));
35+ appInfoLabels .add (new AppInfoLabel ("AndroidGodEye" , "https://github.com/Kyson/AndroidGodEye" , "https://github.com/Kyson/AndroidGodEye" ));
36+ return appInfoLabels ;
37+ }
38+ });
4639 sApplicationStartTime = System .currentTimeMillis ();
4740 MyIntentService .startActionBaz (this , "" , "" );
4841 }
@@ -66,6 +59,10 @@ private static boolean isMainProcess(Application application) {
6659 ActivityManager manager = (ActivityManager ) application .getSystemService
6760 (Context .ACTIVITY_SERVICE );
6861 for (ActivityManager .RunningAppProcessInfo process : manager .getRunningAppProcesses ()) {
62+ Log .d ("kyson" , "process.processName:" + process .processName );
63+ Log .d ("kyson" , "process.pid:" + process .pid );
64+ Log .d ("kyson" , "process.uid:" + process .uid );
65+
6966 if (process .pid == pid ) {
7067 processName = process .processName ;
7168 }
0 commit comments