资源简介

基于Android平台的手机安全卫士的设计与实现 附源码和文档。 做毕业设计,课程设计或者正在学习相关技术知识的朋友可以下载资源学习。想继续学习相关知识的可以关注我。 系统主要功能: 手机防盗 程序锁 通讯卫士 来电归属地 软件管理

资源截图

代码片段和文件信息

package com.bingoogol.frogcare;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Process;

import com.bingoogol.frogcare.util.Constants;
import com.bingoogol.frogcare.util.DateUtil;
import com.bingoogol.frogcare.util.Logger;
import com.bingoogol.frogcare.util.SpUtil;
import com.bingoogol.frogcare.util.StorageUtil;
import com.bingoogol.frogcare.util.ToastUtil;

/**
 * 保存应用程序全局状态的基类
 * 
 * @author bingoogol@sina.com 2014-4-25
 */
public class App extends Application {
private static final String TAG = “App“;

/**
 * 应用程序中所有正在使用的activity集合,主要是用来实现完全退出应用程序功能
 */
private List mActivities;

/**
 * 上一次按下返回键时的时间戳
 */
private long lastTime;

@Override
public void onCreate() {
super.onCreate();
mActivities = new ArrayList();
SpUtil.init(this);
Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler());
}

/**
 * 添加activity到全局状态中
 * 
 * @param activity
 */
public void addActivity(Activity activity) {
mActivities.add(activity);
}

/**
 * 从全局状态中移除activity
 * 
 * @param activity
 */
public void removeActivity(Activity activity) {
mActivities.remove(activity);
}

/**
 * 双击返回键退出应用程序
 */
public void exitWithDoubleClick() {
if (System.currentTimeMillis() - lastTime <= 1500) {
exit();
} else {
lastTime = System.currentTimeMillis();
ToastUtil.makeText(this R.string.exit_tips);
}
}

/**
 * 退出应用程序
 */
public void exit() {
for (Activity activity : mActivities) {
activity.finish();
}
System.exit(0);
}

private class MyUncaughtExceptionHandler implements UncaughtExceptionHandler {

@Override
public void uncaughtException(Thread thread Throwable ex) {
FileWriter fw = null;
try {
File file = new File(StorageUtil.getFeedbackDir() DateUtil.dateToDayString(new Date()) + “.log“);
boolean flag = file.exists();
// 这行执行完,file就存在了,所以得在这之前判断文件是否已经存在
fw = new FileWriter(file true);
if (!flag) {
fw.write(“当前应用版本:“ + getCurrentVersionName() + “\n“);
fw.write(“当前设备信息:\n“);
fw.write(getMobileInfo());
fw.write(“----------------------------------------------------------------------------\n“);
}
fw.write(getErrorInfo(ex));
fw.write(“----------------------------------------------------------------------------\n“);
fw.flush();
// TODO 正式发布后删掉
ex.printStackTrace();
} catch (Exception e) {
Logger.e(TAG e.getMessage());
} finally {
if (fw != null) {
try {
fw.close();
} catch (IOException e) {
Logger.e(TAG e.getMessage());
}
}
}
Process.killPr

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-08-27 15:36  Graduation-Design-master\
     文件         310  2014-08-27 15:36  Graduation-Design-master\.gitignore
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\
     文件         811  2014-08-27 15:36  Graduation-Design-master\FrogCare\.project
     文件        7825  2014-08-27 15:36  Graduation-Design-master\FrogCare\AndroidManifest.xml
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\assets\
     文件     3746816  2014-08-27 15:36  Graduation-Design-master\FrogCare\assets\address.db
     文件      179200  2014-08-27 15:36  Graduation-Design-master\FrogCare\assets\antivirus.db
     文件       29696  2014-08-27 15:36  Graduation-Design-master\FrogCare\assets\commonnum.db
     文件         109  2014-08-27 15:36  Graduation-Design-master\FrogCare\assets\upgrade.json
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\libs\
     文件       60962  2014-08-27 15:36  Graduation-Design-master\FrogCare\libs\android-async-http-1.4.4.jar
     文件      648327  2014-08-27 15:36  Graduation-Design-master\FrogCare\libs\android-support-v4.jar
     文件         440  2014-08-27 15:36  Graduation-Design-master\FrogCare\lint.xml
     文件         781  2014-08-27 15:36  Graduation-Design-master\FrogCare\proguard-project.txt
     文件         563  2014-08-27 15:36  Graduation-Design-master\FrogCare\project.properties
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\
     文件         268  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\appitem_remove_locked.xml
     文件         267  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\appitem_remove_unlock.xml
     文件         142  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\cycle_7.xml
     文件        1255  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\loding.xml
     文件         355  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\rocket.xml
     文件         328  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\scan_virus.xml
     文件         233  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\shake.xml
     文件         259  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\tran_next_in.xml
     文件         260  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\tran_next_out.xml
     文件         260  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\tran_pre_in.xml
     文件         259  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\anim\tran_pre_out.xml
     目录           0  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\color\
     文件         253  2014-08-27 15:36  Graduation-Design-master\FrogCare\res\color\white_blue_selector.xml
............此处省略214个文件信息

评论

共有 条评论