Notification cannot be cleared in Android
<p>I want to create a notification that can be cleared. </p>

<p>e.g. Swipe right on ICS or by "Clear Notifications" button.</p>

<p>I can't figure this out and my notification cannot be cleared.</p>

<p>I tried it both on Froyo &amp; ICS and I got the same issue.</p>

<p>My code is given below:</p>

<pre><code>public class UploadPhotoService extends Service {

    private static final int SERVICE_ID = 999003;

  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {


    Notification note = new Notification(R.drawable.stat_notify_chat,
            "Uploading Photo", System.currentTimeMillis());

    String filePath = intent.getStringExtra("filePath");

    PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(), 0);

    note.setLatestEventInfo(this, "Uploading Photo", filePath, pi);
    note.flags|=Notification.FLAG_AUTO_CANCEL;

    startForeground(SERVICE_ID, note);

    return(START_NOT_STICKY);
  }


  @Override
  public void onDestroy() {
    stop();
  }

  @Override
  public IBinder onBind(Intent intent) {
    return(null);
  }




  private void stop() {

      stopForeground(true);

  }
}
</code></pre>
