title: Alarm Manager does not show notification api 26
body: <p>Works perfectly in the verses until api 25.
  I am new to android and working on Notification Alarm Manager to show notification.</p>
  <p>Can Any one help me what is the error in it?</p>
  <p>Main Activity:</p>
  <pre><code>package br.exemploalarmmanagerbn;
  
  import java.util.Calendar;
  
  import android.app.Activity;
  import android.app.AlarmManager;
  import android.app.PendingIntent;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          
          boolean alarmeAtivo = (PendingIntent.getBroadcast(this, 0, new Intent(&quot;ALARME_DISPARADO&quot;), PendingIntent.FLAG_NO_CREATE) == null);
          
          if(alarmeAtivo){
              Log.i(&quot;Script&quot;, &quot;Novo alarme&quot;);
              
              Intent intent = new Intent(&quot;ALARME_DISPARADO&quot;);
              PendingIntent p = PendingIntent.getBroadcast(this, 0, intent, 0);
              
              Calendar c = Calendar.getInstance();
              c.setTimeInMillis(System.currentTimeMillis());
              c.add(Calendar.SECOND, 3);
              
              AlarmManager alarme = (AlarmManager) getSystemService(ALARM_SERVICE);
              alarme.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), 5000, p);
          }
          else{
              Log.i(&quot;Script&quot;, &quot;Alarme já ativo&quot;);
          }
      }
      
      @Override
      public void onDestroy(){
          super.onDestroy();
          
          /*Intent intent = new Intent(&quot;ALARME_DISPARADO&quot;);
          PendingIntent p = PendingIntent.getBroadcast(this, 0, intent, 0);
          
          AlarmManager alarme = (AlarmManager) getSystemService(ALARM_SERVICE);
          alarme.cancel(p);*/
      }
  } 
  </code></pre>
  <p>BroadcastReceiverAux</p>
  <pre><code>package br.exemploalarmmanagerbn;
  
  import android.app.Notification;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.BitmapFactory;
  import android.media.Ringtone;
  import android.media.RingtoneManager;
  import android.net.Uri;
  import android.support.v4.app.NotificationCompat;
  import android.util.Log;
  
  public class BroadcastReceiverAux extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
          
          Log.i(&quot;Script&quot;, &quot;-&gt; Alarme&quot;);
          
          gerarNotificacao(context, new Intent(context, MainActivity.class), &quot;Nova mensagem&quot;, &quot;Título&quot;, &quot;Descrição nova mensagem&quot;);
      }
      
      
      public void gerarNotificacao(Context context, Intent intent, CharSequence ticker, CharSequence titulo, CharSequence descricao){
  
  if (Build.VERSION.SDK_INT &gt;= 26) {
              if (nm.getNotificationChannel(CHANNEL_ID) == null) {
                  nm.createNotificationChannel(new NotificationChannel(CHANNEL_ID, CHANNEL_NAME,
                          NotificationManager.IMPORTANCE_DEFAULT));
              }
          }
  
          NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
          PendingIntent p = PendingIntent.getActivity(context, 0, intent, 0);
          
          NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
          builder.setTicker(ticker);
          builder.setContentTitle(titulo);
          builder.setContentText(descricao);
          builder.setSmallIcon(R.drawable.ic_launcher);
          builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher));
          builder.setContentIntent(p);
          
          Notification n = builder.build();
          n.vibrate = new long[]{150, 300, 150, 600};
          n.flags = Notification.FLAG_AUTO_CANCEL;
          nm.notify(R.drawable.ic_launcher, n);
          
          try{
              Uri som = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
              Ringtone toque = RingtoneManager.getRingtone(context, som);
              toque.play();
          }
          catch(Exception e){}
      }
  }
  </code></pre>
  <p>Manifest</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;br.exemploalarmmanagerbn&quot;
      android:versionCode=&quot;1&quot;
      android:versionName=&quot;1.0&quot; &gt;
  
      &lt;uses-sdk
          android:minSdkVersion=&quot;8&quot;
          android:targetSdkVersion=&quot;18&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot;/&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:icon=&quot;@drawable/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:theme=&quot;@style/AppTheme&quot; &gt;
          &lt;activity
              android:name=&quot;br.exemploalarmmanagerbn.MainActivity&quot;
              android:label=&quot;@string/app_name&quot; &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;receiver android:name=&quot;BroadcastReceiverAux&quot; android:label=&quot;BroadcastReceiverAux&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;ALARME_DISPARADO&quot;/&gt;
                  &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>