Not able to identify id for item clicked on notification was for unique id which is working out well,now for the same even with different id when i click on notifications i get unique invoice id ,which i am passing to a webservice to get its invoice details,even though its fetching data for that id,the itemActivity page is showing previous details only,how will i update the page with new contents ?
Send Notification code is
public class SampleSchedulingService extends IntentService {
public SampleSchedulingService() {
super("SchedulingService");
}
List<GetReminder> newReminderList;
int invoiceId=0;
String remMes;
InvoiceData1 data1;
int InvM_Id;
public static final String TAG = "Scheduling Demo";
// An ID used to post the notification.
public static int NOTIFICATION_ID = 1;
private NotificationManager mNotificationManager;
NotificationCompat.Builder builder;
@Override
protected void onHandleIntent(Intent intent) {
// BEGIN_INCLUDE(service_onhandle)
// The URL from which to fetch content.
Log.d("MyService", "About to execute MyTask");
//
newReminderList=WebService.invokeGetReminderWS("GetReminder",41);
if(newReminderList!=null){
for(int i=0;i<newReminderList.size();i++) {
sendNotification(newReminderList.get(i).getRemMessage(),newReminderList.get(i).getInvM_Id());
}
}
// Release the wake lock provided by the BroadcastReceiver.
SampleAlarmReceiver.completeWakefulIntent(intent);
// END_INCLUDE(service_onhandle)
}
// Post a notification indicating whether a doodle was found.
private void sendNotification(String msg, int invM_id) {
try {
Intent notificationIntent = new Intent(this, ItemActivity.class);
notificationIntent.setAction(Intent.ACTION_MAIN);
notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
data1=WebService.InvoiceDetailForExeedDiscount1(invM_id);
notificationIntent.putExtra("invoiceList", data1);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(getString(R.string.invoice_alert))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
NOTIFICATION_ID++;}
catch (IOException e) {
} catch (XmlPullParserException e) {
}
}
}
and itemActivity i am reading data like
public class ItemActivity extends Activity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final boolean customTitleSupported =
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.itemlist);
if(customTitleSupported){
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.item);
}
InvoiceData1 invoiceList = (InvoiceData1) getIntent().getSerializableExtra("invoiceList");
}
its like when we come out of the application and click on second notification,its just blandly showing the invoice details of previous one,der is no call going on to fetch data for clicked on.