title: How to show a notification everyday at a certain time even when the app is closed?
body: <p>Although this question might have been asked before on Stack Overflow, I still haven't found a clear answer.</p>
  
  <p>I want to show a notification everyday at 12pm for example even when the app is closed. I have referenced from those links: <a href="https://stackoverflow.com/questions/13121719/notifications-in-specific-time-every-day-android">Notifications in specific time every day android</a>, <a href="https://stackoverflow.com/questions/30128846/android-daily-repeating-notification-at-specific-time-of-a-day-using-alarmmanage">Android daily repeating notification at specific time of a day using AlarmManager</a>, <a href="https://stackoverflow.com/questions/5290141/android-broadcastreceiver-on-startup">Android BroadcastReceiver on startup - keep running when Activity is in Background</a> and much more... I'm confused on the difference between Service and BroadcastReceiver. Which one shall I use? or shall I use both of them?</p>
  
  <p>So far, I know how to show a notification, but I don't know how to show it automatically once everyday even when the app is closed.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>public class NotifyService extends Service {
  
      @Override
      public IBinder onBind(Intent intent) {
          return null;
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
          Toast.makeText(this, "Service created", Toast.LENGTH_LONG).show();
  
          Intent resultIntent = new Intent(this, HomeScreen.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, 0);
  
          Notification.Builder notification = new Notification.Builder(this)
                  .setSmallIcon(R.mipmap.ic_launcher)
                  .setContentTitle("App Title")
                  .setContentText("Some Text...")
                  .setContentIntent(resultPendingIntent);
  
          NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          if (Build.VERSION.SDK_INT &lt; 16) {
              notificationManager.notify(1, notification.getNotification());
          } else {
              notificationManager.notify(1, notification.build());
          }
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          Toast.makeText(this, "Service destroyed", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p><strong>AppManifest.xml:</strong></p>
  
  <pre><code>&lt;service android:name=".NotifyService" /&gt;
  </code></pre>
  
  <p>How should I write my code to accomplish what I want? Any suggestions or any good link that I can understand from?</p>