title: Android - java.lang.IllegalArgumentException: contentIntent required error caused by notification?
body: <p>I have a service running that updates a notification in the notification bar when it recieves a message saying it has to be changed.</p>
  
  <p>However I get the following error sometimes when the notification is to be updated</p>
  
  <pre><code>java.lang.IllegalArgumentException: contentIntent required
  </code></pre>
  
  <p>Here is my code:</p>
  
  <p>Variable setup</p>
  
  <hr>
  
  <pre><code>int icon = R.drawable.notification;
  CharSequence tickerText = "Test";
  long when = System.currentTimeMillis();
  PendingIntent contentIntent;
  
  Notification notification = new Notification(icon, tickerText, when);
  
  NotificationManager mNotificationManager;
  </code></pre>
  
  <hr>
  
  <p>NotificationManager Creation</p>
  
  <hr>
  
  <pre><code>    String ns = Context.NOTIFICATION_SERVICE;
      mNotificationManager = (NotificationManager) getSystemService(ns);
  </code></pre>
  
  <hr>
  
  <p>Notification Creation</p>
  
  <hr>
  
  <pre><code>    Intent notificationIntent = new Intent(this, TestsApp.class);
      contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
      notification.flags |= Notification.FLAG_NO_CLEAR;
      notification.icon = R.drawable.notification3;
      notification.setLatestEventInfo(this, "Registering", "Test", contentIntent);
      mNotificationManager.notify(1, notification);
  </code></pre>
  
  <hr>
  
  <p>Update of Notification</p>
  
  <hr>
  
  <pre><code>    notification.icon = R.drawable.notification2;
      notification.setLatestEventInfo(getApplicationContext(), "Registered", "Test", contentIntent);
      mNotificationManager.notify(1, notification);   
  </code></pre>
  
  <hr>
  
  <p>So something is happening my contentIntent somewhere along the line, would that be correct?</p>
  
  <p>It is declared at the top of my Service class as a member variable and is not used anywhere else in the code apart from shown above, so where could it be getting reset to null? </p>