Send notification from a service running in background after application is closed in Android -


i have made application uses service communicate server. response service used update ui. using broadcastreciever so. when press buton service continuous run in background( not running service on main thread). button closes app. want send notification user service response.

any suggestions?.

notification:

  notificationmanager notificationmanager = (notificationmanager) getsystemservice(notification_service);                  notification.builder builder = new notification.builder(                         getapplicationcontext());                  intent intent = new intent(getapplicationcontext(),                         youractivity.class);                 intent.setaction("notification");                 pendingintent pendingintent = pendingintent.getactivity(                         getapplicationcontext(), 0,    intent,pendingintent.flag_update_current | pendingintent.flag_one_shot);                  builder.setsmallicon(r.drawable.app_icon)                         .setcontenttitle("next appoinment....")                         .setcontenttext(response)                         .setticker("ticker")                         .setlights(0xffff0000, 500, 500)                         // setlights (int argb, int onms, int offms)                         .setcontentintent(pendingintent)                         .setautocancel(true);                  notification notification = builder.getnotification();                 notificationmanager.notify(r.drawable.app_icon,                         notification); 

Comments