Android -- 闹钟服务的使用(启动与停止)

时间:2022-11-26 21:14:58

1. 效果图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAACmCAIAAACa4lvOAAAgAElEQVR4nO2dXVwTV97Hz4UXc+FFLryYp6W7Zktb0rr9MF26GhetpKVb0tI2Y2nX7GN3bdbdYrQtprRLI1pplu7aPLRLU1AbUdFBQIMYHFR0gko7YLGTSiQISNT6At2+b9v75+LEMU4GhhrgBPL/fb4XmWFmcmZyzjeHMy9Bz7zZ/MyG5qXr97eIg//zwJMIIYQQV8d5qjwIIXeFWwgIo+Gt8SKEPJUero5D12PMNhoyDLGL8a08Qsi71YuXRwhZl1mFgKCfq0cI6ebohIBgW2nDf/JUeYSAYFthQ2ox5ZiEgGDIMKj+FSHEZDL2NfafC5PJjLZBCAQCSZIsuTmoYEPz0g372fVNqvo2LjCa880YZ4lTCAhsASvPMeWYUJy+cYzZRjzfmG00LjCiceuboij8nWEvtCOEmExmjO8PTKzNWQsrtAnqBEaZ3yawFnZSDzoEAoEknnh971+6odmyfn+LOHhbnL5jY843CwGBmk0p5qvqGyHkLHXKvkbj1jdCCM1CjiKHbo4OXde3vdBuzjOb88yOIgfum8dOjtEZl2OYZxACgjnfrLkkBAKBJGeU+n524/6CjfufebOpRRy87TdKfdNpNN/KY3AHVp7EQyJoMvQdE6xvJis6uIEHT/Tp+thJ0DcEAkmFKPVtdTX9oazpuY1NBzsHb89S6ls/Vy8EBGepk7WwzlKnEBCsy62shcXjG3hhhb4N8wz2Qru90M7Vcr4mH37NZDLerV7ezztLnM4Sp3erVwgIrnKXs8TpKnPF65uion18rG+ujvNu9Xq3erk6TggIXO1Nk6Ppmy1g5VGRWH1TFOUsdcpfCRAIBDItotT3n972LS/f90fXPr5r4I4H8/FCCn2b88zo5sETe6F9NH2b88y+Jp+vyYeHlfFrc77Zu9UrtAneGq+3xutr8kUtXOPlarl4fTuKHfY1N8a+7WvsrIVlLayj2IEXjp1U1TdN00Kb4Gv04W+CW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+iUO8HgAAMPUQN8+k6/vXf3r71396+/4//3P3ke5fzc+LX4H4bqQ4xNsAkLIQr/wpjra+DSsq7n2h4t4X3q09Ks1d8DjoG1BAXCLALUO88gCJoK3vjJVVhr9W3fu36lrhzNyFT4G+gYmFuMLAnsA0ZRy971Xb7nFoD/gAAAJvSURBVLVvu291za72s3q1Jw4S3wcAAIAUZBxj3y/X3v/Krsyi3XUn+tIfKgB9AwAAJAPa+n7AwT34at381/Y0dJy7J+dZ0DcAAEAyoK3vha/vyS6pf+iNhn0fD9z38HOgbwAAgGRAW985b9Q9sq7+9+sb9ncO3J/7B9A3AABAMqCt78ecux8vrcvfsMff1c88Cr1vAACApEBb3/nOHU+V1rIbdh/sOvebR+HUJQAAQFKgre+nSrwWZ83S0h18Z+9vclV+aV7sFMUOAAAAYAoZl75f3/z037ewb3x48OOzDzxsUdF3hyi0CQAAAMCUIXaMQ99PON7Pf/WDJ4ur/R09mTkqd116Kj18K58QfgAAgBQjMW3iX9PW0PejL7/3+1cqHyt6f/+Jz+5/SOWX5iEQCASSDFHq+yF7xZLV7y1Z8+997cF7F+WTLh4EAoFA1KPU9/zCdxcUvrdg1b8bAsF7skHfEAgEkqRR6jvzxUqm8P0HVnnqAp+lZ8PgCQQCgSRplPq+78Xq+wo3z1u1ZVeg51fZKqcuIRAIBJIMUer7nlXbMuw1Gatratt756o9MBYCgUAgyRClvu9as+uul3bd/dLuHcf7frnoGdLFg0AgEIh6lPq+85X69Ffq019p2HGi/xeLVR4YC4FAIJBkSJy+1+7DbD85cMdDKk8chEAgEEgyJE7frzZjtp88f8eSZaSLB4FAIBD1xOm72H/na/47X/Nv7xi6Y4mVdPEgEAgEop44fb/WgtneMXTHkj+SLh4EAoFA1BOn79dbMNs7hu7IAX1DIBBIkiZe3wfTXz+Y/vrB7R0R0DcEAoEkbRT6/n8DXd1c4FI25QAAAABJRU5ErkJggg==" alt="" />

2. 实现代码

public class firstActivity extends Activity {
private static final String AM_ACTION = "iflab.test.AM_ACTION"; // ACTION常量 /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn1 = (Button) findViewById(R.id.button1); // 获取对象
Button btn2 = (Button) findViewById(R.id.button2);
final AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);// 获取系统服务
Intent intent = new Intent(); // Intent对象
intent.setAction(AM_ACTION); // 设置Action
intent.putExtra("message", "该下班啦!"); // 传递字符串
final PendingIntent pendingIntent = PendingIntent.getBroadcast(
firstActivity.this, 0, intent, 0);
final long time = System.currentTimeMillis(); // 设置当前时间 btn1.setOnClickListener(new View.OnClickListener() { // 监听器 @Override
public void onClick(View v) {
// TODO Auto-generated method stub //设置重复闹钟提醒
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, time,
8 * 1000, pendingIntent);
}
});
btn2.setOnClickListener(new View.OnClickListener() { // 监听器 @Override
public void onClick(View v) {
// TODO Auto-generated method stub
alarmManager.cancel(pendingIntent); // 取消闹钟
}
});
}
}

firstActivity

public class myReceiver extends BroadcastReceiver{

    @Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
String str;
str="触发重复闹钟:"+arg1.getStringExtra("message");
Toast.makeText(arg0, str,Toast.LENGTH_LONG).show(); //显示
}
}

myReceiver

<receiver android:name="myReceiver">
<intent-filter>
<action android:name="iflab.test.AM_ACTION"/>
</intent-filter>
</receiver>