手机卫士09-防盗逻辑实现

简介: 好啦,我们之前已经把设置向导的界面已经全部完成的了,而且界面也已经完成了三个的啦,今天我们把最后的一个界面完成它,还有把防盗的逻辑也完成一下 废话不多说,直接上代码 com.xiaobin.security.ui.SetupGuide4Activity package com.xiaobin.security.ui; import


好啦,我们之前已经把设置向导的界面已经全部完成的了,而且界面也已经完成了三个的啦,今天我们把最后的一个界面完成它,还有把防盗的逻辑也完成一下


废话不多说,直接上代码

com.xiaobin.security.ui.SetupGuide4Activity

  1. package com.xiaobin.security.ui;

  2. import android.app.Activity;
  3. import android.app.AlertDialog;
  4. import android.content.Context;
  5. import android.content.DialogInterface;
  6. import android.content.Intent;
  7. import android.content.SharedPreferences;
  8. import android.content.SharedPreferences.Editor;
  9. import android.os.Bundle;
  10. import android.view.View;
  11. import android.view.View.OnClickListener;
  12. import android.widget.Button;
  13. import android.widget.CheckBox;
  14. import android.widget.CompoundButton;
  15. import android.widget.CompoundButton.OnCheckedChangeListener;

  16. import com.xiaobin.security.R;

  17. public class SetupGuide4Activity extends Activity implements OnClickListener
  18. {
  19.         private Button bt_pervious;
  20.         private Button bt_finish;
  21.         private CheckBox cb_protected;
  22.         private SharedPreferences sp;
  23.         
  24.         @Override
  25.         protected void onCreate(Bundle savedInstanceState)
  26.         {
  27.                 super.onCreate(savedInstanceState);
  28.                 setContentView(R.layout.setup_guide4);
  29.                 
  30.                 bt_pervious = (Button) findViewById(R.id.bt_guide_pervious);
  31.                 bt_finish = (Button) findViewById(R.id.bt_guide_finish);
  32.                 bt_finish.setOnClickListener(this);
  33.                 bt_pervious.setOnClickListener(this);
  34.                 
  35.                 cb_protected = (CheckBox) findViewById(R.id.cb_guide_protected);
  36.                 
  37.                 sp = getSharedPreferences("config", Context.MODE_PRIVATE);
  38.                 boolean isProtecting = sp.getBoolean("isProtected", false);
  39.                 if(isProtecting)
  40.                 {
  41.                         cb_protected.setText("已经开启保护");
  42.                         cb_protected.setChecked(true);
  43.                 }
  44.                 
  45.                 cb_protected.setOnCheckedChangeListener(new OnCheckedChangeListener()
  46.                 {
  47.                         @Override
  48.                         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
  49.                         {
  50.                                 if(isChecked)
  51.                                 {
  52.                                         cb_protected.setText("已经开启保护");
  53.                                         Editor editor = sp.edit();
  54.                                         editor.putBoolean("isProtected", true);
  55.                                         editor.commit();
  56.                                 }
  57.                                 else
  58.                                 {
  59.                                         cb_protected.setText("没有开启保护");
  60.                                         Editor editor = sp.edit();
  61.                                         editor.putBoolean("isProtected", false);
  62.                                         editor.commit();
  63.                                 }
  64.                         }
  65.                 });
  66.         }

  67.         @Override
  68.         public void onClick(View v)
  69.         {
  70.                 switch(v.getId())
  71.                 {
  72.                         case R.id.bt_guide_finish : 
  73.                                 if(cb_protected.isChecked())
  74.                                 {
  75.                                         Editor editor = sp.edit();
  76.                                         editor.putBoolean("setupGuide", true);//记录是否已经进行过设置向导了
  77.                                         editor.commit();
  78.                                         finish();
  79.                                 }
  80.                                 else
  81.                                 {
  82.                                         AlertDialog.Builder builder = new AlertDialog.Builder(this);
  83.                                         builder.setTitle("提醒");
  84.                                         builder.setMessage("强烈建议您开启保护, 是否完成设置");
  85.                                         builder.setCancelable(false);
  86.                                         builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
  87.                                         {
  88.                                                 @Override
  89.                                                 public void onClick(DialogInterface dialog, int which)
  90.                                                 {
  91.                                                         Editor editor = sp.edit();
  92.                                                         editor.putBoolean("setupGuide", true);//记录是否已经进行过设置向导了
  93.                                                         editor.commit();
  94.                                                         finish();
  95.                                                 }
  96.                                         });
  97.                                         builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener()
  98.                                         {
  99.                                                 @Override
  100.                                                 public void onClick(DialogInterface dialog, int which)
  101.                                                 {
  102.                                                         Editor editor = sp.edit();
  103.                                                         editor.putBoolean("setupGuide", true);//记录是否已经进行过设置向导了
  104.                                                         editor.commit();
  105.                                                 }
  106.                                         });
  107.                                         builder.create().show();
  108.                                 }
  109.                                 break;
  110.                                 
  111.                         case R.id.bt_guide_pervious : 
  112.                                 Intent intent = new Intent(this, SetupGuide3Activity.class);
  113.                                 finish();
  114.                                 startActivity(intent);
  115.                                 //这个是定义activity切换时的动画效果的
  116.                                 overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
  117.                                 break;
  118.                                 
  119.                         default : 
  120.                                 break;
  121.                 }
  122.         }

  123. }
复制代码
好啦,就这个样子,我们的设置向导就全部完成的啦,现在我们就要来写完我们的防盗主界面啦,lost_protected.xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     android:layout_width="match_parent"
  4.     android:layout_height="match_parent"
  5.     android:orientation="vertical" >
  6.     
  7.     <TextView 
  8.         android:id="@+id/tv_lost_protected_number"
  9.         android:layout_width="match_parent"
  10.         android:layout_height="wrap_content"
  11.         android:layout_marginTop="5dip"
  12.         android:text="@string/lostProtectedNumber"
  13.         android:textSize="20sp"/>
  14.     
  15.     <View 
  16.         style="@style/SetGuideUnderline"/>
  17.     
  18.     <CheckBox 
  19.         android:id="@+id/cb_lost_protected_isProtected"
  20.         android:layout_width="wrap_content"
  21.         android:layout_height="wrap_content"
  22.         android:text="@string/isProtected"
  23.         android:textSize="20sp"/>
  24.     
  25.     <View 
  26.         style="@style/SetGuideUnderline"/>
  27.     
  28.     <TextView 
  29.         android:id="@+id/tv_lost_protected_guide"
  30.         android:layout_width="match_parent"
  31.         android:layout_height="wrap_content"
  32.         android:text="@string/rePlayGuide"
  33.         android:textSize="20sp"/>

  34. </LinearLayout>
复制代码
com.xiaobin.security.ui.LostProtectedActivit
  1. package com.xiaobin.security.ui;

  2. import android.app.Activity;
  3. import android.app.Dialog;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.content.SharedPreferences;
  7. import android.content.SharedPreferences.Editor;
  8. import android.os.Bundle;
  9. import android.view.View;
  10. import android.view.View.OnClickListener;
  11. import android.widget.Button;
  12. import android.widget.CheckBox;
  13. import android.widget.CompoundButton;
  14. import android.widget.EditText;
  15. import android.widget.TextView;
  16. import android.widget.Toast;
  17. import android.widget.CompoundButton.OnCheckedChangeListener;

  18. import com.xiaobin.security.R;
  19. import com.xiaobin.security.utils.MD5Encoder;

  20. public class LostProtectedActivity extends Activity implements OnClickListener
  21. {
  22.         private SharedPreferences sp;
  23.         private Dialog dialog;
  24.         private EditText password;
  25.         private EditText confirmPassword;
  26.         private TextView tv_protectedNumber;
  27.         private TextView tv_protectedGuide;
  28.         private CheckBox cb_isProtected;
  29.         
  30.         @Override
  31.         protected void onCreate(Bundle savedInstanceState)
  32.         {
  33.                 super.onCreate(savedInstanceState);
  34.                 
  35.                 sp = getSharedPreferences("config", Context.MODE_PRIVATE);
  36.                 
  37.                 if(isSetPassword())
  38.                 {
  39.                         showLoginDialog();
  40.                 }
  41.                 else
  42.                 {
  43.                         showFirstDialog();
  44.                 }
  45.         }
  46.         
  47.         private void showLoginDialog()
  48.         {
  49.                 dialog = new Dialog(this, R.style.MyDialog);
  50.                 View view = View.inflate(this, R.layout.login_dialog, null);
  51.                 password = (EditText) view.findViewById(R.id.et_protected_password);
  52.                 Button yes = (Button) view.findViewById(R.id.bt_protected_login_yes);
  53.                 Button cancel = (Button) view.findViewById(R.id.bt_protected_login_no);
  54.                 yes.setOnClickListener(this);
  55.                 cancel.setOnClickListener(this);
  56.                 dialog.setContentView(view);
  57.                 dialog.setCancelable(false);
  58.                 dialog.show();
  59.         }

  60.         private void showFirstDialog()
  61.         {
  62.                 dialog = new Dialog(this, R.style.MyDialog);
  63.                 //dialog.setContentView(R.layout.first_dialog);
  64.                 View view = View.inflate(this, R.layout.first_dialog, null);//这种填充布局的方式比较方便,峭用拿到一个LayoutInflate对象
  65.                 password = (EditText) view.findViewById(R.id.et_protected_first_password);
  66.                 confirmPassword = (EditText) view.findViewById(R.id.et_protected_confirm_password);
  67.                 Button yes = (Button) view.findViewById(R.id.bt_protected_first_yes);
  68.                 Button cancel = (Button) view.findViewById(R.id.bt_protected_first_no);
  69.                 yes.setOnClickListener(this);
  70.                 cancel.setOnClickListener(this);
  71.                 dialog.setContentView(view);
  72.                 dialog.setCancelable(false);
  73.                 dialog.show();
  74.         }

  75.         private boolean isSetPassword()
  76.         {
  77.                 String pwd = sp.getString("password", "");
  78.                 if(pwd.equals("") || pwd == null)
  79.                 {
  80.                         return false;
  81.                 }
  82.                 return true;
  83.         }
  84.         
  85.         private boolean isSetupGuide()
  86.         {
  87.                 return sp.getBoolean("setupGuide", false);
  88.         }

  89.         @Override
  90.         public void onClick(View v)
  91.         {
  92.                 switch(v.getId())
  93.                 {
  94.                         case R.id.bt_protected_first_yes : 
  95.                                 String fp = password.getText().toString().trim();
  96.                                 String cp = confirmPassword.getText().toString().trim();
  97.                                 if(fp.equals("") || cp.equals(""))
  98.                                 {
  99.                                         Toast.makeText(this, "密码不能为空", Toast.LENGTH_SHORT).show();
  100.                                         return;
  101.                                 }
  102.                                 else 
  103.                                 {
  104.                                         if(fp.equals(cp))
  105.                                         {
  106.                                                 Editor editor = sp.edit();
  107.                                                 editor.putString("password", MD5Encoder.encode(fp));
  108.                                                 editor.commit();
  109.                                                 dialog.dismiss();
  110.                                                 
  111.                                                 if(!isSetupGuide())
  112.                                                 {
  113.                                                         finish();
  114.                                                         Intent intent = new Intent(this, SetupGuide1Activity.class);
  115.                                                         startActivity(intent);
  116.                                                 }
  117.                                         }
  118.                                         else
  119.                                         {
  120.                                                 Toast.makeText(this, "两次密码不相同", Toast.LENGTH_SHORT).show();
  121.                                                 return;
  122.                                         }
  123.                                 }
  124.                                 dialog.dismiss();
  125.                                 break;
  126.                                 
  127.                         case R.id.bt_protected_first_no : 
  128.                                 dialog.dismiss();
  129.                                 finish();
  130.                                 break;
  131.                                 
  132.                         case R.id.bt_protected_login_yes : 
  133.                                 String pwd = password.getText().toString().toString();
  134.                                 if(pwd.equals(""))
  135.                                 {
  136.                                         Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
  137.                                 }
  138.                                 else
  139.                                 {
  140.                                         String str = sp.getString("password", "");
  141.                                         if(MD5Encoder.encode(pwd).equals(str))
  142.                                         {
  143.                                                 if(isSetupGuide())
  144.                                                 {
  145.                                                         setContentView(R.layout.lost_protected);
  146.                                                         tv_protectedNumber = (TextView) findViewById(R.id.tv_lost_protected_number);
  147.                                                         tv_protectedGuide = (TextView) findViewById(R.id.tv_lost_protected_guide);
  148.                                                         cb_isProtected = (CheckBox) findViewById(R.id.cb_lost_protected_isProtected);
  149.                                                         
  150.                                                         tv_protectedNumber.setText("手机安全号码为:" + sp.getString("number", ""));
  151.                                                         tv_protectedGuide.setOnClickListener(this);
  152.                                                         
  153.                                                         boolean isProtecting = sp.getBoolean("isProtected", false);
  154.                                                         if(isProtecting)
  155.                                                         {
  156.                                                                 cb_isProtected.setText("已经开启保护");
  157.                                                                 cb_isProtected.setChecked(true);
  158.                                                         }
  159.                                                         
  160.                                                         cb_isProtected.setOnCheckedChangeListener(new OnCheckedChangeListener()
  161.                                                         {
  162.                                                                 @Override
  163.                                                                 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
  164.                                                                 {
  165.                                                                         if(isChecked)
  166.                                                                         {
  167.                                                                                 cb_isProtected.setText("已经开启保护");
  168.                                                                                 Editor editor = sp.edit();
  169.                                                                                 editor.putBoolean("isProtected", true);
  170.                                                                                 editor.commit();
  171.                                                                         }
  172.                                                                         else
  173.                                                                         {
  174.                                                                                 cb_isProtected.setText("没有开启保护");
  175.                                                                                 Editor editor = sp.edit();
  176.                                                                                 editor.putBoolean("isProtected", false);
  177.                                                                                 editor.commit();
  178.                                                                         }
  179.                                                                 }
  180.                                                         });
  181.                                                 }
  182.                                                 dialog.dismiss();
  183.                                         }
  184.                                         else
  185.                                         {
  186.                                                 Toast.makeText(this, "密码错误", Toast.LENGTH_SHORT).show();
  187.                                         }
  188.                                 }
  189.                                 break;
  190.                                 
  191.                         case R.id.bt_protected_login_no : 
  192.                                 dialog.dismiss();
  193.                                 finish();
  194.                                 break;
  195.                                 
  196.                         case R.id.tv_lost_protected_guide : //重新进入设置向导
  197.                                 finish();
  198.                                 Intent setupGuideIntent = new Intent(this, SetupGuide1Activity.class);
  199.                                 startActivity(setupGuideIntent);
  200.                                 break;
  201.                                 
  202.                         default : 
  203.                                 break;
  204.                 }
  205.         }

  206. }
复制代码
  1. com.xiaobin.security.ui.<span style="font-family:Arial, Helvetica, sans-serif;">SetupGuide2Activity </span>
复制代码
  1. package com.xiaobin.security.ui;

  2. import android.app.Activity;
  3. import android.content.Context;
  4. import android.content.Intent;
  5. import android.content.SharedPreferences;
  6. import android.content.SharedPreferences.Editor;
  7. import android.os.Bundle;
  8. import android.telephony.TelephonyManager;
  9. import android.view.View;
  10. import android.view.View.OnClickListener;
  11. import android.widget.Button;
  12. import android.widget.CheckBox;
  13. import android.widget.CompoundButton;
  14. import android.widget.CompoundButton.OnCheckedChangeListener;

  15. import com.xiaobin.security.R;

  16. public class SetupGuide2Activity extends Activity implements OnClickListener
  17. {
  18.         private Button bt_bind;
  19.         private Button bt_next;
  20.         private Button bt_pervious;
  21.         private CheckBox cb_bind;
  22.         private SharedPreferences sp;
  23.         
  24.         @Override
  25.         protected void onCreate(Bundle savedInstanceState)
  26.         {
  27.                 super.onCreate(savedInstanceState);
  28.                 setContentView(R.layout.setup_guide2);
  29.                 
  30.                 sp = getSharedPreferences("config", Context.MODE_PRIVATE);
  31.                 
  32.                 bt_bind = (Button) findViewById(R.id.bt_guide_bind);
  33.                 bt_next = (Button) findViewById(R.id.bt_guide_next);
  34.                 bt_pervious = (Button) findViewById(R.id.bt_guide_pervious);
  35.                 bt_bind.setOnClickListener(this);
  36.                 bt_next.setOnClickListener(this);
  37.                 bt_pervious.setOnClickListener(this);
  38.                 
  39.                 cb_bind = (CheckBox) findViewById(R.id.cb_guide_check);
  40.                 //初始化CheckBox状态
  41.                 String sim = sp.getString("simSerial", null);
  42.                 if(sim != null)
  43.                 {
  44.                         cb_bind.setText("已经绑定");
  45.                         cb_bind.setChecked(true);
  46.                 }
  47.                 else
  48.                 {
  49.                         cb_bind.setText("没有绑定");
  50.                         cb_bind.setChecked(false);
  51.                         resetSimInfo();
  52.                 }
  53.                 cb_bind.setOnCheckedChangeListener(new OnCheckedChangeListener()
  54.                 {
  55.                         @Override
  56.                         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
  57.                         {
  58.                                 if(isChecked)
  59.                                 {
  60.                                         cb_bind.setText("已经绑定");
  61.                                         setSimInfo();
  62.                                 }
  63.                                 else
  64.                                 {
  65.                                         cb_bind.setText("没有绑定");
  66.                                         resetSimInfo();
  67.                                 }
  68.                         }
  69.                 });
  70.         }

  71.         @Override
  72.         public void onClick(View v)
  73.         {
  74.                 switch(v.getId())
  75.                 {
  76.                         case R.id.bt_guide_bind : 
  77.                                 setSimInfo();
  78.                                 cb_bind.setText("已经绑定");
  79.                                 cb_bind.setChecked(true);
  80.                                 break;
  81.                                 
  82.                         case R.id.bt_guide_next : 
  83.                                 Intent intent = new Intent(this, SetupGuide3Activity.class);
  84.                                 finish();
  85.                                 startActivity(intent);
  86.                                 //这个是定义activity切换时的动画效果的
  87.                                 overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
  88.                                 break;
  89.                         case R.id.bt_guide_pervious : 
  90.                                 
  91.                                 Intent i = new Intent(this, SetupGuide1Activity.class);
  92.                                 finish();
  93.                                 startActivity(i);
  94.                                 //这个是定义activity切换时的动画效果的
  95.                                 overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
  96.                                 break;
  97.                                 
  98.                         default : 
  99.                                 break;
  100.                 }
  101.         }
  102.         
  103.         private void setSimInfo()
  104.         {
  105.                 TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
  106.                 String simSerial = telephonyManager.getSimSerialNumber();//拿到sim卡的序列号,是唯一的
  107.                 Editor editor = sp.edit();
  108.                 editor.putString("simSerial", simSerial);
  109.                 editor.commit();
  110.         }
  111.         
  112.         private void resetSimInfo()        //解除绑定
  113.         {
  114.                 Editor editor = sp.edit();
  115.                 editor.putString("simSerial", null);
  116.                 editor.commit();
  117.         }

  118. }
复制代码
好啦,到现在为止,我们的手机防盗这个功能的界面就基本上完成的啦,那么现在就进入我们的重头戏啦,就是防盗逻辑的完成啦,我们现在的防盗是这样的,手机丢失的时候,小偷肯定是会换sim卡的嘛,所以就要重启啦,那我们就在启动完成之后,比较一下现在的sim卡,是不是我们之前设置保护的sim卡,如果不是,那就发送一条短信到已经设置了的安全号码那里。所以现在我们只要写一个广播接收者,把手机重启的广播接收到,然后再起进行判断就行啦好啦,现在直接上代码com.xiaobin.security.receiver.BootCompleteReceiver
  1. package com.xiaobin.security.receiver;

  2. import android.content.BroadcastReceiver;
  3. import android.content.Context;
  4. import android.content.Intent;
  5. import android.content.SharedPreferences;
  6. import android.telephony.SmsManager;
  7. import android.telephony.TelephonyManager;

  8. public class BootCompleteReceiver extends BroadcastReceiver
  9. {
  10.         private SharedPreferences sp;

  11.         @Override
  12.         public void onReceive(Context context, Intent intent)
  13.         {
  14.                 sp = context.getSharedPreferences("config", Context.MODE_PRIVATE);
  15.                 boolean isProtected = sp.getBoolean("isProtected", false);
  16.                 //看看是不是开启了保护
  17.                 if(isProtected)
  18.                 {
  19.                         TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  20.                         //开机后,拿到当前sim卡的标识,与我们之前存放的标识对比
  21.                         String currentSim = telephonyManager.getSimSerialNumber();
  22.                         String protectedSim = sp.getString("simSerial", "");
  23.                         if(!currentSim.equals(protectedSim))
  24.                         {
  25.                                 //拿到一个短信的管理器,要注意不要导错包,是在android.telephony下的
  26.                                 SmsManager smsManager = SmsManager.getDefault();
  27.                                 String number = sp.getString("number", "");
  28.                                 //发送短信,有5个参数,第一个是要发送到的地址,第二个是发送人,可以设置为null,第三个是要发送的信息,第四个是发送状态,第五个是发送后的,都可以置为null
  29.                                 smsManager.sendTextMessage(number, null, "Sim卡已经变更了,手机可能被盗", null, null);
  30.                         }
  31.                 }
  32.         }

  33. }
复制代码
好啦,现在我们就要在AndroidManifest文件里面注册这个广播接收者啦
  1.         <receiver 
  2.             android:name="com.xiaobin.security.receiver.BootCompleteReceiver">
  3.             <intent-filter android:priority="1000">
  4.                 <action android:name="android.intent.action.BOOT_COMPLETED"/><!-- 这个是开机完成后的广播 -->
  5.             </intent-filter>
  6.         </receiver>
复制代码
当然,现在还不行的,我们还要把相应的权限加上
  1.     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  2.     <uses-permission android:name="android.permission.SEND_SMS"/>
复制代码
好啦,现在我们的逻辑就基本上完成的啦但现在这个功能还不是很完整,所以我们后续的课程将会继续完善这个防盗的功能的,比如加入gps定位啦,这些的。 好,今天的代码就到这里了,如果有什么不明白的,和指导的,欢迎留言!,明天将会完善这个防盗功能,加入gps!  Security_09防盗逻辑以及设置向导的完成.rar (233.32 KB, 下载次数: 50) 
目录
相关文章
|
Android开发
《手机卫士性能优化方案-Android篇》电子版地址
手机卫士性能优化方案-Android篇
75 0
《手机卫士性能优化方案-Android篇》电子版地址
|
安全
金山手机卫士正式版发布 永久免费
近日,金山安全软件有限公司首次公开发布金山手机卫士正式版,并宣布下载,安装,升级金山手机卫士完全免费,手机卫士是金山安全软件公司今年成立后回馈用户的又一力作。目前支持主流的智能手机操作系统——塞班S60和Android。
988 0
|
XML API Android开发
Android--手机卫士涉及的知识点总结(一)
Splash界面 splash: 溅,洒 展现产品的logo提升产品的知名度 初始化操作(创建数据库,读取配置文件) 连接服务器检查软件授权 连接服务器检查软件的更新 自动更新的前提 包名...
1121 0
|
算法 数据库 Android开发
Android--手机卫士涉及的知识点总结(二)
短信拦截:开启服务并在里面注册一个广播接收者 ? 1 2 3 开启服务: Intent intent=new Intent(SettingActivity.
903 0
|
数据库 Android开发 数据安全/隐私保护
Android--手机卫士涉及的知识点总结(五)
主活动中点击切换 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
871 0
|
缓存 安全 数据库
Android--手机卫士涉及的知识点总结(六)
内容观察者 数据库中大声发个消息 ? 1 2 Uri uri=Uri.
1429 0
|
XML Android开发 数据格式
手机卫士11-手机锁屏和出厂恢复功能
有些不知道怎么用我们这个锁屏的功能 ,其实很简单的,我们只要把服务 开启了,然后如果 你要进行锁屏,那么就可以通过 另一台手机,发送一条锁屏的短信如: #*lockscreen*# 复制代码 就会锁屏的啦,具体服务 怎么开,就要看看我们前面的内容 啦! 好啦,我们今天就来继续我们的手机防盗啊,今天我们应该就会把手机防盗这个功能全部完成它的啦, 昨天我
1166 0
|
Android开发 数据格式 XML
手机卫士12-号码归属地查询
手机防盗的功能我们已经完成的啦,里面有挺多知识点的,大家最好总结一下。或再看看是怎样写的。 好啦,今天我们的任务比较简单,就是把手机归属地查询的界面做出来而已,逻辑我们明天才完成,这一次,我们就不会通过WebService来获得手机的归属地的啦,我们直接把数据库嵌入到的我们的应用里面,这个我们就明天再说啦,今天先把界面做好 com.xiaobin.security.u
1353 0
手机卫士14-显示来电归属地
好啦,我们今天就要把号码归属地显示在有电话打进来的时候,其实也很简单的啦,我们只要开一个服务,监听电话的广播,然后在电话相应的状态,进行相应的操作就可以的啦 至于怎样把那个view显示到接听电话那个界面上,这个更简单啦,那个Toast是怎样显示的,我们就怎样显示就可以了。 我们打开Toast的源码,可以发现在一个静态的内部类TN里面,有这样一段代码
1200 0

热门文章

最新文章