title: Notification in API26 and higher will not be show,but in lower API it will be show
body: <p>I have written the same Notification for API26 and higher and lower with if-else, I have an Alarm_Receiver and in Manifest, I have also written (my Receiver Android name and Intent Filter and my Service android name).
  The notification in API Lower than 26 works quite right, but in API 26 and API 27 it works just when the app is open and when I close the app, then at alarm time I get an error "the app has been stopped" and notification will not be a show.
  Can you help me what should I do?</p>
  
  <p>and one more thing
  when my emulator starts with API 27, I get an error "the system is not responding." close the app or wait.
  but if I wait, then my app will be run and while app open is, I get Notification, but when I close the app, then I don't get Notification and I get an Error "the app has Stopped".
  Emulator is 5.1 WVGA
  has Resolution 480x800 and RAM 512.</p>
  
  <p>I am not a <strong>Pro</strong>. I am new in Android Studio.</p>
  
  <pre><code>   public int onStartCommand(Intent intent, int flags, int startId) {
      if(Build.VERSION.SDK_INT &gt;= 26){
  
          NotificationManager mNotificationManager =
                  (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          String idsh = "my_channel_01";
          int notificationID = 1;
          CharSequence name = getString(R.string.hello_world);
          String description = getString(R.string.hello_world);
          int importance = NotificationManager.IMPORTANCE_HIGH;
  
          Uri sounduri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  
  
          NotificationChannel mChannel = new NotificationChannel(idsh, name, importance);
  // Configure the notification channel.
          mChannel.setDescription(description);
          mChannel.enableLights(true);
          mChannel.setLightColor(Color.RED);
          mChannel.enableVibration(true);
          mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
          mChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
          assert mNotificationManager != null;
          mNotificationManager.createNotificationChannel(mChannel);
          Intent resultIntent = new Intent(this, MainActivity.class);
          PendingIntent resultPendingIntent =
                  PendingIntent.getActivity(
                          this,
                          0,
                          resultIntent,
                          PendingIntent.FLAG_UPDATE_CURRENT
                  );
  
  
  
          Notification notification = new Notification.Builder(this,idsh)
                  .setContentTitle("Hello World")
                  .setContentText("Hellooooo")
                  .setBadgeIconType(R.mipmap.ic_launcher)
                  .setNumber(5)
                  .setContentIntent(resultPendingIntent)
                  .setSmallIcon(R.mipmap.ic_launcher_round)
                  .setAutoCancel(true)
                  .build();
  
  
  
          assert mNotificationManager != null;
          mNotificationManager.notify(notificationID, notification);
  
          Log.i("LocalService", "Received start id " + startId + ": " + intent);
  
          }else{
          Uri sounduri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          NotificationCompat.Builder mBuilder =
                  new NotificationCompat.Builder(this)
                          .setSmallIcon(R.drawable.ic_launcher_background)
                          .setSound(sounduri)
                          .setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
                          .setContentTitle("Hello World")
                          .setContentText("Hello World");
          Intent resultIntent = new Intent(this, MainActivity.class);
          // Because clicking the notification opens a new ("special") activity, there's
  
          PendingIntent resultPendingIntent =
                  PendingIntent.getActivity(
                          this,
                          0,
                          resultIntent,
                          PendingIntent.FLAG_UPDATE_CURRENT
                  );
  
          mBuilder.setContentIntent(resultPendingIntent);
          // Sets an ID for the notification
          int mNotificationId = 001;
  
          NotificationManager mNotifyMgr =
                  (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  
          assert mNotifyMgr != null;
          mNotifyMgr.notify(mNotificationId, mBuilder.build());
  
          }
  </code></pre>
  
  <p>first i get this Error in Logcat:</p>
  
  <pre><code>android.gms.persistent E/GcmPushIntentOperation: Failed to subscribe to GCM: com.google.android.inputmethod.latin
                                                                                       java.io.IOException: TIMEOUT
                                                                                           at vab.b(:com.google.android.gms@11577470:42)
                                                                                           at vab.a(:com.google.android.gms@11577470:46)
                                                                                           at uzy.b(:com.google.android.gms@11577470:11)
                                                                                           at uzy.a(:com.google.android.gms@11577470:29)
                                                                                           at com.google.android.gms.phenotype.gcmpush.GcmPushIntentOperation.a(:com.google.android.gms@11577470:22)
                                                                                           at com.google.android.gms.phenotype.gcmpush.GcmPushIntentOperation.onHandleIntent(:com.google.android.gms@11577470:6)
                                                                                           at com.google.android.chimera.IntentOperation.onHandleIntent(:com.google.android.gms@11577470:2)
                                                                                           at bwh.run(:com.google.android.gms@11577470:10)
                                                                                           at bwe.run(:com.google.android.gms@11577470:14)
                                                                                           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                                           at java.lang.Thread.run(Thread.java:764)
  </code></pre>
  
  <p>and this:</p>
  
  <p>E/ConfigUpdater: ignoring update request</p>
  
  <p>and then One Minute after Alarmtime i get in Emulator Error: App has Stopped and in Logcat:</p>
  
  <pre><code> Process: com.example.standard.alarm, PID: 3903
                                                                        java.lang.RuntimeException: Unable to start receiver com.example.standard.alarm.Alarm_Receiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.demo.FirebaseMessagingReceiveService cmp=com.example.standard.alarm/.RingtonePlayingService }: app is in background uid UidRecord{8d38734 u0a79 RCVR idle change:uncached procs:1 seq(0,0,0)}
                                                                            at android.app.ActivityThread.handleReceiver(ActivityThread.java:3194)
                                                                            at android.app.ActivityThread.-wrap17(Unknown Source:0)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                            at android.os.Looper.loop(Looper.java:164)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                                                                         Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.demo.FirebaseMessagingReceiveService cmp=com.example.standard.alarm/.RingtonePlayingService }: app is in background uid UidRecord{8d38734 u0a79 RCVR idle change:uncached procs:1 seq(0,0,0)}
                                                                            at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1518)
                                                                            at android.app.ContextImpl.startService(ContextImpl.java:1474)
                                                                            at android.content.ContextWrapper.startService(ContextWrapper.java:649)
                                                                            at android.content.ContextWrapper.startService(ContextWrapper.java:649)
                                                                            at com.example.standard.alarm.Alarm_Receiver.onReceive(Alarm_Receiver.java:15)
                                                                            at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
  </code></pre>