title: Exception: android.app.RemoteServiceException Bad notification posted from package
body: <p>I have an application on the Play Store,Recently I've been received a lot of crash on ActivityThread.java with the message</p>
  
  <p>Fatal Exception</p>
  
  <blockquote>
    <p>Fatal Exception: android.app.RemoteServiceException
    Bad notification posted from package XXX: Couldn't expand RemoteViews for: StatusBarNotification(pkg=XXX user=UserHandle{0} id=1 tag=null score=0: Notification(pri=0 contentView=XXX/0x1090065 vibrate=null sound=null defaults=0x0 flags=0x0 kind=[null]))</p>
  </blockquote>
  
  <pre><code>    alarmNotificationManager = (NotificationManager) this
              .getSystemService(Context.NOTIFICATION_SERVICE);
  
      PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
              new Intent(this, MainActivity.class), 0);
  
  
      NotificationCompat.Builder alamNotificationBuilder = new NotificationCompat.Builder(
              this,"1").setContentTitle("Prayer Time Alert!").setSmallIcon(R.mipmap.icon_logo)
              .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
              .setDeleteIntent(createOnDismissedIntent(this,1))
              .setContentText(msg);
  
  
      alamNotificationBuilder.setContentIntent(contentIntent);
      alarmNotificationManager.notify(1, alamNotificationBuilder.build());
  
  private PendingIntent createOnDismissedIntent(Context context, int notificationId) {
      Intent intent = new Intent(context, NotificationDismissedReceiver.class);
      intent.putExtra("com.my.app.notificationId", notificationId);
  
      PendingIntent pendingIntent =
              PendingIntent.getBroadcast(context.getApplicationContext(),
                      notificationId, intent, 0);
      return pendingIntent;
  
  }
  public class NotificationDismissedReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      int notificationId = intent.getExtras().getInt("com.my.app.notificationId");
    /* Your code to handle the event here */
      if (Global.mPlayer != null) {
          Global.mPlayer.stop();
      }
      NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
      manager.cancel(notificationId);
  }
  }
  </code></pre>