|
@@ -7,7 +7,6 @@ import android.database.sqlite.SQLiteDatabase;
|
|
|
import android.graphics.Point;
|
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
|
-import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Display;
|
|
|
import android.view.WindowManager;
|
|
@@ -21,13 +20,7 @@ import com.sunzee.model.Heartbeat;
|
|
|
import com.sunzee.model.domain.Name;
|
|
|
import com.sunzee.service.MyService;
|
|
|
import com.sunzee.utils.FileUtil;
|
|
|
-import com.sunzee.utils.GeTuiUtil;
|
|
|
import com.sunzee.utils.SharedPreferencesUtils;
|
|
|
-import com.tencent.bugly.crashreport.CrashReport;
|
|
|
-
|
|
|
-import java.io.BufferedReader;
|
|
|
-import java.io.FileReader;
|
|
|
-import java.io.IOException;
|
|
|
|
|
|
/**
|
|
|
* Created by MinKin.
|
|
@@ -44,11 +37,10 @@ public class BaseApplication extends Application {
|
|
|
public static int mRealSizeWidth;//手机屏幕真实宽度
|
|
|
public static int mRealSizeHeight;//手机屏幕真实高度
|
|
|
private static final String TAG = "BaseApplication";
|
|
|
+
|
|
|
@Override
|
|
|
public void onCreate() {
|
|
|
super.onCreate();
|
|
|
- //初始化bugly
|
|
|
- initBugly();
|
|
|
mContext = this;
|
|
|
instances = this;
|
|
|
Hawk.init(this).build();
|
|
@@ -76,58 +68,9 @@ public class BaseApplication extends Application {
|
|
|
}
|
|
|
mRealSizeHeight = outPoint.y;
|
|
|
mRealSizeWidth = outPoint.x;
|
|
|
- Log.d(TAG, "GTgetScreenHeight: "+mRealSizeHeight);
|
|
|
- Log.d(TAG, "GTgetScreenWidth: "+mRealSizeWidth);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 初始化bugly
|
|
|
- */
|
|
|
- private void initBugly() {
|
|
|
- Context context = getApplicationContext();
|
|
|
- // 获取当前包名
|
|
|
- String packageName = context.getPackageName();
|
|
|
- // 获取当前进程名
|
|
|
- String processName = getProcessName(android.os.Process.myPid());
|
|
|
- // 设置是否为上报进程
|
|
|
- CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
|
|
|
- strategy.setUploadProcess(processName == null || processName.equals(packageName));
|
|
|
- // 初始化Bugly
|
|
|
- CrashReport.initCrashReport(context, "b764cadec8", true, strategy);
|
|
|
- // 如果通过“AndroidManifest.xml”来配置APP信息,初始化方法如下
|
|
|
- // CrashReport.initCrashReport(context, strategy);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取进程号对应的进程名
|
|
|
- *
|
|
|
- * @param pid 进程号
|
|
|
- * @return 进程名
|
|
|
- */
|
|
|
- private static String getProcessName(int pid) {
|
|
|
- BufferedReader reader = null;
|
|
|
- try {
|
|
|
- reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
|
|
|
- String processName = reader.readLine();
|
|
|
- if (!TextUtils.isEmpty(processName)) {
|
|
|
- processName = processName.trim();
|
|
|
- }
|
|
|
- return processName;
|
|
|
- } catch (Throwable throwable) {
|
|
|
- throwable.printStackTrace();
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- if (reader != null) {
|
|
|
- reader.close();
|
|
|
- }
|
|
|
- } catch (IOException exception) {
|
|
|
- exception.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
+ Log.d(TAG, "GTgetScreenHeight: " + mRealSizeHeight);
|
|
|
+ Log.d(TAG, "GTgetScreenWidth: " + mRealSizeWidth);
|
|
|
}
|
|
|
- //-------------------------------------------------------------------------------------bugly end -------------------------------------------
|
|
|
|
|
|
/**
|
|
|
* 首次心跳
|