private void postNotification(Context context, AnswerSet answerSet, String message) {
        int surveyId = answerSet.getDbSurveyId();
        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
        Intent intent = new Intent(context, SurveyActivity.class);
        intent.putExtra("programId", answerSet.getDbProgramId());
        intent.putExtra("answerSetUUID", answerSet.getUuid());
        intent.setAction("com.sema.notification." + surveyId);
        PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        Survey survey = answerSet.getSurvey();
        Program program = survey != null ? survey.getProgram() : null;
        if (survey != null && program != null) {
            String programName = program.getDisplayName();
            Notification n = new NotificationCompat.Builder(context)
                    .setContentTitle(programName)
                    .setContentText(message)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentIntent(pIntent)
                    .setAutoCancel(true)
                    .setSound(Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.notification_extended))
                    .build();
            notificationManager.notify(answerSet.getStartAlarmRequestCode(), n); // TODO: alternatively could use the same app wide if want only one entry in notifications
        }
    }
private void postNotification(Context context, AnswerSet answerSet, String message) {
        int surveyId = answerSet.getDbSurveyId();
        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
        Intent intent = new Intent(context, SurveyActivity.class);
        intent.putExtra("programId", answerSet.getDbProgramId());
        intent.putExtra("answerSetUUID", answerSet.getUuid());
        intent.setAction("com.sema.notification." + surveyId);
        PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        Survey survey = answerSet.getSurvey();
        Program program = survey != null ? survey.getProgram() : null;
        if (survey != null && program != null) {
            String programName = program.getDisplayName();
            Notification n = new NotificationCompat.Builder(context)
                    .setContentTitle(programName)
                    .setContentText(message)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentIntent(pIntent)
                    .setAutoCancel(true)
                    .setSound(Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.notification_extended))
                    .build();
            notificationManager.notify(answerSet.getStartAlarmRequestCode(), n);
        }
    }
private void postnotification(context context, answerset answerset, string message) { int surveyid = answerset.getdbsurveyid(); notificationmanager notificationmanager = (notificationmanager)context.getsystemservice(context.notification_service); intent intent = new intent(context, surveyactivity.class); intent.putextra("programid", answerset.getdbprogramid()); intent.putextra("answersetuuid", answerset.getuuid()); intent.setaction("com.sema.notification." + surveyid); pendingintent pintent = pendingintent.getactivity(context, 0, intent, pendingintent.flag_update_current); survey survey = answerset.getsurvey(); program program = survey != null ? survey.getprogram() : null; if (survey != null && program != null) { string programname = program.getdisplayname(); notification n = new notificationcompat.builder(context) .setcontenttitle(programname) .setcontenttext(message) .setsmallicon(r.drawable.ic_launcher) .setcontentintent(pintent) .setautocancel(true) .setsound(uri.parse("android.resource://" + context.getpackagename() + "/" + r.raw.notification_extended)) .build(); notificationmanager.notify(answerset.getstartalarmrequestcode(), n); } }