KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
i am trying to show different notifications after some time interval but what happens is it updates the current PendingIntent by the new one as a result i get only single notification even if i fire 4 - 5 pending intents requests On button click i do the following thing try{ adapter.OpenDB(); int id = adapter.getMaxId("reminder")+1; adapter.CloseDB(); Intent intent = new Intent(MilestonesActivity.this, AlarmReceiver.class); intent.putExtra("message", ""+editMsg.getText()+" "+editDate.getText()); intent.putExtra("id", id); PendingIntent pendingIntent = PendingIntent.getBroadcast(MilestonesActivity.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); am.set(AlarmManager.RTC_WAKEUP, reminddate.getTimeInMillis(), pendingIntent); adapter.CloseDB(); }catch (Exception e) { // TODO: handle exception } AlarmReceiver.java @Override public void onReceive(Context context, Intent intent) { Intent i =new Intent(context, NotificationService.class); try{ int id = intent.getExtras().getInt("id"); i.putExtra("id", id); CharSequence message = intent.getExtras().getString("message"); i.putExtra("message", message); }catch (Exception e) { // TODO: handle exception } context.startService(i); } NotificationService.java public void show(Intent intent) { try{ NotificationManager nm; Log.e("recieve", "ok"); nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); CharSequence from = "Lawyer app Reminder"; CharSequence message = intent.getExtras().getString("message"); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(),
Tags (comma-separated)
Save Edits
Cancel