我正在android中发出通知,但是在通知出现之前我有一点延迟 - 这是正常的吗?这是我的代码:
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();
答案 0 :(得分:0)
System.currentTimeMillis() + (5 * 1000)
表示来自5
的{{1}} seconds
。