title: Android java sent notification once
body: <p>How do I sent the notification only once if something happens?
  I got this statement:</p>
  
  <pre><code>if (diffDays &lt;= 0 &amp;&amp; diffHours &lt;= 0 &amp;&amp; diffMinutes &lt;= 0) {
  
      activity.sendNotificationIfTimeEnd01();
      Log.d("MyApp", "I am here");
  }
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>public void sendNotificationIfTimeEnd01() {
      Intent intent = new Intent(Intent.ACTION_VIEW,
              Uri.parse("https://www.google.de/?gws_rd=ssl"));
      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
      NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
      builder.setSmallIcon(R.drawable.ic_stat_notification);
      builder.setContentIntent(pendingIntent);
      builder.setAutoCancel(true);
      builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
      builder.setContentTitle("String one");
      builder.setContentText("bla");
      builder.setSubText("blabla");
      NotificationManager notificationManager = (NotificationManager) getSystemService(
              NOTIFICATION_SERVICE);
      notificationManager.notify(NOTIFICATION_ID, builder.build());
      try {
          Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
          r.play();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>I do get the notification if the statement is right, but if I close the app and start it I get the notification again.(Statement is still right);</p>