In Facebook android app we get notifications while app is forced closed. It works because there is the push notification implemented. But i have implemented the local notification in my app and i want my app notify if app is forced closed. so how can i implement it.
void showNotify()
{
CharSequence details = "Notification raised";
int reqCode=0;
Intent notificationIntent = new Intent(context,
NotifyListActivity.class);
// notificationIntent.putExtra("clicked", "Notification Clicked");
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_SINGLE_TOP); // To open only one activity
// on launch.
PendingIntent pIntent = PendingIntent.getActivity(context, reqCode,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager nM = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notify = new NotificationCompat.Builder(
context);
notify.setContentIntent(pIntent);
notify.setSmallIcon(R.drawable.appicon);
notify.setContentTitle("");
notify.setContentText(details);
notify.setAutoCancel(true);
nM.notify(reqCode, notify.build());
screenOn(context);
}