Android Notification .addAction function -
mdatabase.child("reportlist").child(i).child("ambulance_coming").setvalue("rejected");
above code allows me make notification. problem is, i've added 2 .addaction
notification. when press reject button, want line
notificationcompat.builder builder = new notificationcompat.builder(homescreenambulance.this); builder.setsmallicon(r.drawable.ic_launcher); builder.setautocancel(true); string header = "report received:"; builder.setcontenttitle(header); string body = "location:"+location; builder.setcontenttext(body); intent intent = new intent("ph.edu.upm.agila.extendthelife.controller.rescuer.ambulance.mainscreenambulance"); intent.putextra("fa_id",fa_id); taskstackbuilder stackbuilder = taskstackbuilder.create(homescreenambulance.this); stackbuilder.addparentstack(mainscreenambulance.class); stackbuilder.addnextintent(intent); pendingintent pendingintent = stackbuilder.getpendingintent(0, pendingintent.flag_update_current); builder.addaction(r.drawable.ic_launcher,"reject",null); builder.addaction(r.drawable.ic_launcher,"accept",pendingintent); builder.setcontentintent(pendingintent); notificationmanager nm = (notificationmanager) getsystemservice(context.notification_service); nm.notify((int) system.currenttimemillis(),builder.build());
Comments
Post a Comment