开发者

Android notifications delay

I'm making a notification in android, but I have a small delay before the notification appears - is this norm开发者_运维百科al? Here is my code:

final int REQUEST_CODE = 1;         
Intent intent = new Intent(Add_Assignment.this, Assignment_AlarmReceiver.class);
//Bundle stuff omitted for brevity
PendingIntent pendingIntent = 
      PendingIntent.getBroadcast(Add_Assignment.this, REQUEST_CODE, intent, 0);


AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, 
           System.currentTimeMillis() + (5 * 1000), pendingIntent);
Toast.makeText(Add_Assignment.this, "Alarm set", Toast.LENGTH_LONG).show();


System.currentTimeMillis() + (5 * 1000) means 5 seconds from now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜