| | |
| | | import android.os.Looper; |
| | | |
| | | import com.doumee.keyCabinet.ui.guide.GuideActivity; |
| | | import com.doumee.keyCabinet.ui.main.MainActivity; |
| | | import com.doumee.lib_coremodel.util.SpUtil; |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.io.PrintStream; |
| | | import java.io.PrintWriter; |
| | |
| | | dumpExceptionToSDCard(ex); |
| | | //System.out.println("重启应用"); |
| | | // 创建一个新的启动意图 |
| | | Intent intent = new Intent(mContext, GuideActivity.class); |
| | | /*Intent intent = new Intent(mContext, MainActivity.class); |
| | | // 设置FLAG_ACTIVITY_CLEAR_TASK标志位 |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| | | // 使用PendingIntent包装启动意图 |
| | |
| | | // 获取AlarmManager实例 |
| | | AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); |
| | | // 在500毫秒后触发重启操作 |
| | | alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 10, pendingIntent); |
| | | alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 10, pendingIntent);*/ |
| | | |
| | | android.os.Process.killProcess(android.os.Process.myPid()); |
| | | System.exit(1); |
| | |
| | | //LogUtils.e(TAG, "dump crash info failed"); |
| | | } |
| | | //以当前时间创建log文件 |
| | | /*File file = new File(PATH , FILE_NAME + time + FILE_NAME_SUFFIX); |
| | | File file = new File(PATH , FILE_NAME + time + FILE_NAME_SUFFIX); |
| | | try { |
| | | PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); |
| | | //导出发生异常的时间 |
| | |
| | | e.printStackTrace(); |
| | | System.out.println("错误日志2"+e.getMessage()); |
| | | //LogUtils.e(TAG, "dump crash info failed"); |
| | | }*/ |
| | | } |
| | | } |
| | | private void dumpPhoneInfo(PrintStream pw) throws NameNotFoundException { |
| | | //应用的版本名称和版本号 |
| | |
| | | //cpu架构 |
| | | pw.print("CPU ABI: "); |
| | | pw.println(Build.CPU_ABI); } |
| | | |
| | | private void dumpPhoneInfo(PrintWriter pw) throws NameNotFoundException { |
| | | //应用的版本名称和版本号 |
| | | PackageManager pm = mContext.getPackageManager(); |
| | | PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES); |
| | | pw.print("App Version: "); |
| | | pw.print(pi.versionName); |
| | | pw.print('_'); |
| | | pw.println(pi.versionCode); |
| | | //android版本号 |
| | | pw.print("OS Version: "); |
| | | pw.print(Build.VERSION.RELEASE); |
| | | pw.print("_"); |
| | | pw.println(Build.VERSION.SDK_INT); |
| | | //手机制造商 |
| | | pw.print("Vendor: "); |
| | | pw.println(Build.MANUFACTURER); |
| | | //手机型号 pw.print("Model: "); |
| | | pw.println(Build.MODEL); |
| | | //cpu架构 |
| | | pw.print("CPU ABI: "); |
| | | pw.println(Build.CPU_ABI); } |
| | | } |