Android notification with pending Intent
<p>I am sending notification depending on some logic. </p>

<pre><code>public class DbAdapter_Assignment extends DbAdapter {

public DbAdapter_Assignment(Context context) {
    super(context);
}

 public void deleteUnassignedTask(Assignment[] assignments)
{
    //some logic
    sendNotification(String a. String b);
}

 private void triggerNotification(String s, String id)     
{         
    CharSequence title = "TASK UNASSIGNED";         
    CharSequence message = s;    
    NotificationManager notificationManager;
    notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);         
    Notification notification = new Notification(R.drawable.checkno, s, System.currentTimeMillis());  

    notification.flags = Notification.FLAG_AUTO_CANCEL;
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;

    // No. 1 solution
    PendingIntent pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(id), null, PendingIntent.FLAG_UPDATE_CURRENT); 
    // -----------

    // No. 2 solution
    Intent notificationIntent = new Intent(context, MyTask.class);
    notificationIntent.putExtra("EmpID", Functions.getLoginEmpID(context));
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP );
    PendingIntent pendingIntent = PendingIntent.getActivity(context,
            Integer.parseInt(id), notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    // ----------------

    notification.setLatestEventInfo(context, title, message, pendingIntent);  
    notificationManager.notify(Integer.parseInt(id), notification);    
} 
</code></pre>

<p>}</p>

<p>No. 1 solution is working. the thing I want to add is if click on that notification, go to MyTask class. So I tried No. 2 solution and IT"S NOT WORKING for me. It doesn't show any notification if do no. 2 solution. What am I missing? Is ir because of the class is not an activity or servise ? </p>
