我现在在做一个提醒吃药的程序,为了使得我的程序在关闭的状态下,还能够定时闹钟,所以想把闹钟设置为系统的闹钟,请问怎样可以做到呢?
解决方案 »
- android模拟器中键盘无法弹出
- 运行时控制台总是出现emulator-5554 disconnected,模拟器不能运行
- android 在service中用onStart()获取activity传递的值,能接受到这个值,但是不能应用于全局变量呢?
- 如何杀掉本应用在堆栈中的所有activity,而不杀掉本应用的服务?
- The content of the adapter has changed but....
- 在java代码中怎么得到xml布局文件中的TabHost?
- 将android环境配置好后,出现模拟器不能启动的问题!
- 如何获取内存使用情况、手机号码等系统信息?
- 求高手帮我看下我下面这段获取root权限的代码,为什么还是没有成功
- 用环境变量实现了静默安装,原理不明白,请高人解释。
- android工程根目录下文件的获取
- 测试通讯录livefolder报错
Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
获取闹钟管理的实例: AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
设置单次闹钟:alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5*1000), pendingIntent);
设置周期闹钟:alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (10*1000), (24*60*60*1000), pendingIntent);