title: Check if notification is active
body: <p>i'm building a notification that is launched with a toggle button:</p>
  
  <pre><code>    toggleLigar.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              if(toggleLigar.isChecked()){
                  NotificationUtil.cancelaAll(TelaCriaDesp.this);
  
                  CharSequence tickerText = "Despertador ativado!";
                  CharSequence title = "Você não vai perder seu ponto!";
                  CharSequence message = "O despertador " + despertador.getNomeDesp() + " está ativo!";
                  Intent intent = new Intent(TelaCriaDesp.this, TelaCriaDesp.class);
  
                  NotificationUtil.criaNotification(TelaCriaDesp.this, tickerText, title, message,
                                                    despertador.getDesp_id(), intent);
              } else {
                  NotificationUtil.cancelaNotification(TelaCriaDesp.this, despertador.getDesp_id());
              }
          }
      });
  </code></pre>
  
  <p>now i want to assign the toggle button in ON or OFF according to the notification state, if it's active (being displayed) it's ON, inactive OFF... I have tried this:</p>
  
  <pre><code>    public static boolean testaNotification(int id, Context context){
      Intent intent = new Intent(context, TelaCriaDesp.class);
      //intent.setAction(Intent.);
      PendingIntent teste = PendingIntent.getActivity(context, id, intent,
                                                  PendingIntent.FLAG_NO_CREATE);
      return teste  != null;
  }
  </code></pre>
  
  <p>but it's not working, it always returns NULL...</p>
  
  <p>here's my notification creation:</p>
  
  <pre><code>   public class NotificationUtil {
  
  @SuppressWarnings("deprecation")
  public static void criaNotification(Context context, CharSequence tickerText, CharSequence title,
                                      CharSequence message, int id, Intent intent){
  
      PendingIntent aoSelecionar = PendingIntent.getActivity(context, 0, intent, 0);
  
      Notification notification = null;
      int apiLevel = Build.VERSION.SDK_INT;
  
      if(apiLevel &gt;= 11){
          Builder montaNotification = new Notification.Builder(context)
                                                      .setContentTitle(tickerText)
                                                      .setContentText(message)
                                                      .setSmallIcon(R.drawable.icon)
                                                      .setContentIntent(aoSelecionar);
  
          //montaNotification.setAutoCancel(true);
          montaNotification.setOngoing(true);
  
          if(apiLevel &gt;= 17){
              notification = montaNotification.build();
          } else {
              notification = montaNotification.getNotification();
          }
      } else {
          notification = new Notification(R.drawable.icon, tickerText, System.currentTimeMillis());
  
          notification.setLatestEventInfo(context, title, message, aoSelecionar);
          //notification.flags |= Notification.FLAG_AUTO_CANCEL;
          notification.flags |= Notification.FLAG_ONGOING_EVENT;
      }
  
      NotificationManager manager = (NotificationManager) 
                                    context.getSystemService(Activity.NOTIFICATION_SERVICE);
  
      manager.notify(id, notification);
  
  }
  </code></pre>