コード例 #1
0
ファイル: AlarmService.java プロジェクト: alexBeuth/whatsToDo
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    Bundle bundle = intent.getExtras();

    TodoListManager.getInstance().load(bundle.getLong("ListId"));
    task = TaskManager.getInstance().load(bundle.getLong("TaskId"));

    if (task.getReminder() != null) {

      Intent nIntent = new Intent(this, TaskActivity.class);
      nIntent.putExtras(bundle);

      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, nIntent, 0);

      NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
      Notification notif =
          new Notification(R.drawable.ic_launcher, "WhatsToDo", System.currentTimeMillis());
      notif.setLatestEventInfo(this, "WhatsToDo", "Erinnerung: " + task.getName(), pendingIntent);
      notif.vibrate = new long[] {100, 250, 100, 500};
      nm.notify((int) task.getId(), notif);
    }
  }
コード例 #2
0
 @Override
 protected boolean filter(Task task) {
   return task.getPriority().equals(Priority.LOW);
 }