content: package com.fajarnandagusti.cataloguemoviefinal.scheduler;
  
  import android.app.NotificationChannel;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Color;
  import android.provider.Settings;
  import android.support.v4.app.NotificationCompat;
  
  import com.fajarnandagusti.cataloguemoviefinal.R;
  import com.fajarnandagusti.cataloguemoviefinal.activity.MainActivity;
  
  import static com.fajarnandagusti.cataloguemoviefinal.utils.Utility.NOTIFICATION_CHANNEL_ID;
  
  /**
   * Created by Gustiawan on 11/17/2018.
   */
  
  public class NotificationHelper {
      private Context mContext;
  
      public NotificationHelper(Context context) {
          mContext = context;
      }
  
      public void createNotification(String title, String message){
          Intent resultIntent = new Intent(mContext, MainActivity.class);
          resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          PendingIntent resultPendingIntent = PendingIntent.getActivity(mContext,
                  0 , resultIntent,
                  PendingIntent.FLAG_UPDATE_CURRENT);
          NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext);
          mBuilder.setSmallIcon(R.mipmap.ic_launcher);
          mBuilder.setContentTitle(title)
                  .setContentText(message)
                  .setAutoCancel(false)
                  .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
                  .setContentIntent(resultPendingIntent);
  
          NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
          if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
              int importance = NotificationManager.IMPORTANCE_HIGH;
              NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "NOTIFICATION_CHANNEL_NAME", importance);
              notificationChannel.enableLights(true);
              notificationChannel.setLightColor(Color.RED);
              notificationChannel.enableVibration(true);
              notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
              assert mNotificationManager != null;
              mBuilder.setChannelId(NOTIFICATION_CHANNEL_ID);
              mNotificationManager.createNotificationChannel(notificationChannel);
          }
          assert mNotificationManager != null;
          mNotificationManager.notify(0, mBuilder.build());
  
      }
  
  }
  