Android(Java):长时间未登录提醒

@Override
 protected void onPause() {
  // TODO Auto-generated method stub
  super.onPause();
  currentTime = System.currentTimeMillis();
 }
 
 @Override
 protected void onResume() {
  // TODO Auto-generated method stub
  super.onResume();
  if(currentTime!=0 && System.currentTimeMillis() - this.currentTime > PERIOD){
   new AlertDialog.Builder(this)
   .setTitle("提示")
   .setMessage("您已10天未在线登录,为了您的账号安全请重新登录")
   .setPositiveButton("确定",new DialogInterface.OnClickListener() {

    @Override
    public void onClick(DialogInterface paramDialogInterface,
      int paramInt) {
     // TODO Auto-generated method stub
     //GlobalModel.getInstance().getDownloadTask().removeAllTast();
     Intent intent = new Intent(MainActivity.this, LoginActivity.class);
     startActivity(intent);
     MainActivity.this.finish();
     
    }
   }).show();
  }
 }

你可能感兴趣的:(android,长时间未登录提醒)