资源简介
安卓定时任务,每隔多久,后台执行service,可以做到很流氓,开机自启动,甚至你把程序杀死他还会执行.zip,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
代码片段和文件信息
package com.coder80.timer;
import com.coder80.timer.utils.ServiceUtil;
import android.support.v7.app.ActionBarActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by coder80 on 2014/10/31.
*/
public class MainActivity extends ActionBarActivity implements View.onclickListener{
private TextView mTextView;
private Button mBtnStart;
private Button mBtnStop;
private Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mTextView = (TextView) findViewById(R.id.show);
mBtnStart = (Button) findViewById(R.id.button1);
mBtnStop = (Button) findViewById(R.id.button2);
mBtnStart.setonclickListener(this);
mBtnStop.setonclickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onclick(View v) {
// TODO Auto-generated method stub
int id = v.getId();
switch(id){
case R.id.button1:
ServiceUtil.invokeTimerPOIService(mContext);
break;
case R.id.button2:
ServiceUtil.cancleAlarmManager(mContext);
break;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-11-03 15:33 AlarmManagerTest\
目录 0 2014-11-03 17:08 AlarmManagerTest\AlarmManager\
文件 475 2014-10-31 23:55 AlarmManagerTest\AlarmManager\.classpath
文件 852 2014-10-31 23:52 AlarmManagerTest\AlarmManager\.project
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\.settings\
文件 57 2014-11-01 00:24 AlarmManagerTest\AlarmManager\.settings\org.eclipse.core.resources.prefs
文件 177 2014-10-31 23:52 AlarmManagerTest\AlarmManager\.settings\org.eclipse.jdt.core.prefs
文件 1493 2014-11-03 16:04 AlarmManagerTest\AlarmManager\AndroidManifest.xm
目录 0 2014-11-03 17:09 AlarmManagerTest\AlarmManager\assets\
文件 51394 2014-10-31 23:52 AlarmManagerTest\AlarmManager\ic_launcher-web.png
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\libs\
文件 758727 2014-10-31 23:52 AlarmManagerTest\AlarmManager\libs\android-support-v4.jar
文件 781 2014-10-31 23:52 AlarmManagerTest\AlarmManager\proguard-project.txt
文件 607 2014-10-31 23:55 AlarmManagerTest\AlarmManager\project.properties
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\drawable-hdpi\
文件 7658 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\drawable-hdpi\ic_launcher.png
目录 0 2014-11-03 17:09 AlarmManagerTest\AlarmManager\res\drawable-ldpi\
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\drawable-mdpi\
文件 3777 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\drawable-mdpi\ic_launcher.png
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\drawable-xhdpi\
文件 12516 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\drawable-xhdpi\ic_launcher.png
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\drawable-xxhdpi\
文件 24777 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\drawable-xxhdpi\ic_launcher.png
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\layout\
文件 1657 2014-11-01 00:00 AlarmManagerTest\AlarmManager\res\layout\activity_main.xm
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\menu\
文件 420 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\menu\main.xm
目录 0 2014-11-03 15:33 AlarmManagerTest\AlarmManager\res\values\
文件 220 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\values\dimens.xm
文件 233 2014-10-31 23:52 AlarmManagerTest\AlarmManager\res\values\strings.xm
............此处省略536个文件信息
评论
共有 条评论