海正尝试设置报警每10 minutes.But它的运行仅第一次任何机构好心帮我
意向意图=新的意图(这一点,ConnectionReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(此,0,
意图,PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager =(AlarmManager)getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP,System.currentTimeMillis的()+(1 * 1000),pendingIntent);
Toast.makeText(这一点,报警设置,Toast.LENGTH_LONG).show(); //每10分钟我要打印的敬酒
解决方案
使用alarmManager.setRepeating方法
遵循开发者的网站链接
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlarmService.html
http://developer.android.com/reference/android/app/AlarmManager.html#setRepeating(int,很长很长,android.app.PendingIntent)
Hai am trying to set alarm for every 10 minutes.But its running first time only any Body kindly help me
Intent intent = new Intent(this, ConnectionReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (1 * 1000), pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();//every 10 minutes i want to print the toast
解决方案
use alarmManager.setRepeating method
follow this link on developer site
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlarmService.html
http://developer.android.com/reference/android/app/AlarmManager.html#setRepeating(int, long, long, android.app.PendingIntent)
下一篇:体积变化监听器:是registerMediaButtonEventReceiver preferable到的onkeydown?监听器、体积、registerMediaButtonEventRecei