2014-01-22 24 views
1

我经由广播接收器& AlarmManager由定时通知:Android通知&Alarmmanager - 定时不同

我认识到,报警doesn't开始每24秒。这取决于。我提出接收器中的日志记录:(格式:H - M - S)

Post Nofification: 10 - 47 - 0 
Post Nofification: 10 - 47 - 13 
Post Nofification: 10 - 47 - 37 
Post Nofification: 10 - 48 - 1 
Post Nofification: 10 - 48 - 25 
Post Nofification: 10 - 49 - 0 
Post Nofification: 10 - 49 - 13 
Post Nofification: 10 - 49 - 37 
Post Nofification: 10 - 50 - 1 
Post Nofification: 10 - 50 - 25 
Post Nofification: 10 - 51 - 0 
Post Nofification: 10 - 51 - 13 
Post Nofification: 10 - 51 - 37 
Post Nofification: 10 - 52 - 1 
Post Nofification: 10 - 52 - 42 
Post Nofification: 10 - 53 - 0 
Post Nofification: 10 - 53 - 13 

我不知道为什么该通知是短有时/更长。 任何想法如何解决这个问题?

+0

您可以发布您启动报警服务的代码 – suresh

回答

2

注:与API开始19(奇巧)报警交付是不精确的:操作系统将为了尽量减少唤醒和电池使用SHIFT报警。有新的API支持需要严格交付保证的应用程序;请参阅setWindow(int,long,long,PendingIntent)和setExact(int,long,PendingIntent)。 targetSdkVersion早于API 19的应用程序将继续看到之前的行为,即所有报警在请求时都准确传送。

请在这里看到http://developer.android.com/reference/android/app/AlarmManager.html

1

只要已经了解它,AlarmManager并不精确。
在新API level 19 of AlarmManager你有

public void setExact (int type, long triggerAtMillis, PendingIntent operation)