Example usage for android.app Notification DEFAULT_SOUND

List of usage examples for android.app Notification DEFAULT_SOUND

Introduction

In this page you can find the example usage for android.app Notification DEFAULT_SOUND.

Prototype

int DEFAULT_SOUND

To view the source code for android.app Notification DEFAULT_SOUND.

Click Source Link

Document

Use the default notification sound.

Usage

From source file:com.craftsilicon.littlecabrider.GCMIntentService.java

private void generateNotificationNew(Context context, String message) {
    final Notification.Builder builder = new Notification.Builder(this);
    builder.setDefaults(//from  w  w w  .  j a  va  2  s. co m
            Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE);
    builder.setStyle(new Notification.BigTextStyle(builder).bigText(message)
            .setBigContentTitle(context.getString(R.string.app_name)))
            .setContentTitle(context.getString(R.string.app_name)).setContentText(message)
            .setSmallIcon(R.drawable.ic_launcher);
    builder.setAutoCancel(true);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(intent);
    final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(0, builder.build());
}

From source file:com.money.manager.ex.notifications.RepeatingTransactionNotifications.java

public void notifyRepeatingTransaction() {
    // create application
    CurrencyUtils currencyUtils = new CurrencyUtils(context);
    // init currencies
    if (!currencyUtils.isInit())
        currencyUtils.init();//from w ww .  j  a  v a2 s .c o  m

    // select data
    QueryBillDeposits billDeposits = new QueryBillDeposits(context);
    MoneyManagerOpenHelper databaseHelper = new MoneyManagerOpenHelper(context);

    if (databaseHelper != null) {
        Cursor cursor = databaseHelper.getReadableDatabase().rawQuery(billDeposits.getSource() + " AND "
                + QueryBillDeposits.DAYSLEFT + "<=0 ORDER BY " + QueryBillDeposits.NEXTOCCURRENCEDATE, null);
        if (cursor != null) {
            if (cursor.getCount() > 0) {
                cursor.moveToFirst();
                NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
                while (!cursor.isAfterLast()) {
                    String line = cursor
                            .getString(cursor.getColumnIndex(QueryBillDeposits.USERNEXTOCCURRENCEDATE)) + " "
                            + cursor.getString(cursor.getColumnIndex(QueryBillDeposits.PAYEENAME)) + ": <b>"
                            + currencyUtils.getCurrencyFormatted(
                                    cursor.getInt(cursor.getColumnIndex(QueryBillDeposits.CURRENCYID)),
                                    cursor.getDouble(cursor.getColumnIndex(QueryBillDeposits.AMOUNT)))
                            + "</b>";
                    // add line
                    inboxStyle.addLine(Html.fromHtml("<small>" + line + "</small>"));
                    // move to next row
                    cursor.moveToNext();
                }

                NotificationManager notificationManager = (NotificationManager) context
                        .getSystemService(Context.NOTIFICATION_SERVICE);
                // create pendig intent
                Intent intent = new Intent(context, RepeatingTransactionListActivity.class);
                // set launch from notification // check pin code
                intent.putExtra(RepeatingTransactionListActivity.INTENT_EXTRA_LAUNCH_NOTIFICATION, true);

                PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
                // create notification
                Notification notification = null;
                try {
                    notification = new NotificationCompat.Builder(context).setAutoCancel(true)
                            .setContentIntent(pendingIntent)
                            .setContentTitle(context.getString(R.string.application_name))
                            .setContentText(
                                    context.getString(R.string.notification_repeating_transaction_expired))
                            .setSubText(context
                                    .getString(R.string.notification_click_to_check_repeating_transaction))
                            .setSmallIcon(R.drawable.ic_stat_notification)
                            .setTicker(context.getString(R.string.notification_repeating_transaction_expired))
                            .setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND
                                    | Notification.DEFAULT_LIGHTS)
                            .setNumber(cursor.getCount()).setStyle(inboxStyle).build();
                    // notify 
                    notificationManager.cancel(ID_NOTIFICATION);
                    notificationManager.notify(ID_NOTIFICATION, notification);
                } catch (Exception e) {
                    Log.e(LOGCAT, e.getMessage());
                }
            }
            // close cursor
            cursor.close();
        }
        // close database helper
        //databaseHelper.close();
    }
}

From source file:com.survtapp.gcm.MyGcmListenerService.java

private Notification setBigPictureStyleNotification(String msg, String url, String title) {
    Bitmap remote_picture = null;//from   w ww  .j a v a  2s  .  c om
    // Create the style object with BigPictureStyle subclass.
    NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle();
    notiStyle.setBigContentTitle(title);
    notiStyle.setSummaryText(msg);
    try {
        remote_picture = getBitmapFromURL(url);
    } catch (Exception e) {
        e.printStackTrace();
    }
    notiStyle.bigPicture(remote_picture);
    Intent resultIntent = new Intent(this, MainActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    return new NotificationCompat.Builder(this).setSmallIcon(R.drawable.survtapp_notification)
            .setColor(getResources().getColor(R.color.actionbar_color)).setAutoCancel(true)
            .setDefaults(
                    Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.FLAG_SHOW_LIGHTS)
            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setContentIntent(resultPendingIntent).setContentTitle(title).setContentText(msg)
            .setStyle(notiStyle).build();
}

From source file:com.cyeam.cInterphone.ui.CInterphone.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // Set default fragment.
    mViewPager.setCurrentItem(1);/*  w  w  w  .  j  av a 2  s .  c  om*/

    // Account[] accounts = AccountManager.get(this).getAccountsByType(
    // "com.google");
    // if (accounts.length > 0) {
    // Settings.DEFAULT_USERNAME = accounts[0].name;
    // }
    Receiver.engine(this).StartEngine();

    PushManager.startWork(getApplicationContext(), PushConstants.LOGIN_TYPE_API_KEY,
            Utils.getMetaValue(CInterphone.this, "api_key"));
    CustomPushNotificationBuilder cBuilder = new CustomPushNotificationBuilder(this,
            R.layout.ongoing_call_notification, R.id.icon, R.id.text1, R.id.text2);
    cBuilder.setNotificationFlags(Notification.FLAG_AUTO_CANCEL);
    cBuilder.setNotificationDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
    cBuilder.setStatusbarIcon(R.drawable.icon64);
    cBuilder.setLayoutDrawable(R.drawable.icon22);
    PushManager.setNotificationBuilder(this, 0, cBuilder);

    Push.Push(new com.cyeam.cInterphone.model.Notification("hello, world"));
}

From source file:com.woodblockwithoutco.quickcontroldock.prefs.ui.fragments.GeneralPrefsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.misc_prefs);

    mPackPreference = (ListPreference) findPreference(Keys.ExternalResources.EXTERNAL_RESOURCE_PACKAGE);

    mPrefsKeysDialog = new PrefsKeysDialog();
    mXmlPrefsDialog = new PrefsXmlDialog();

    findPreference("force_crash").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override/*  www  . j  ava 2s . c  o m*/
        public boolean onPreferenceClick(Preference preference) {
            String date = DateFormat.getTimeFormat(getActivity()).format(Calendar.getInstance().getTime());
            throw new RuntimeException("App has been crashed manually[" + date + "]");
        }
    });

    findPreference("list_prefs").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            mPrefsKeysDialog.show(getFragmentManager(), TAG);
            return true;
        }
    });

    findPreference("list_prefs_xml").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            mXmlPrefsDialog.show(getFragmentManager(), TAG_XML);
            return true;
        }
    });

    findPreference("save_prefs_xml").setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            saveXmlToFile();
            return true;
        }
    });

    findPreference("post_notification_dismissable")
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    NotificationCompat.Builder builder = new NotificationCompat.Builder(
                            getActivity().getApplicationContext());
                    int id = 0;
                    final int MAX_NOTIFICATIONS = 50;
                    Random r = new Random();
                    id = 10000 + r.nextInt(MAX_NOTIFICATIONS);
                    builder.setContentTitle("TEST");
                    builder.setOngoing(false);
                    builder.setContentText("TEST TEXT " + id);
                    builder.setDefaults(Notification.DEFAULT_SOUND);
                    builder.setSmallIcon(R.drawable.ic_notification);
                    NotificationManager mgr = (NotificationManager) getActivity()
                            .getSystemService(Context.NOTIFICATION_SERVICE);
                    mgr.notify(id, builder.build());
                    return true;
                }
            });

    findPreference("post_notification_dismissable_delay")
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {

                private Handler mHandler = new Handler();

                @Override
                public boolean onPreferenceClick(Preference preference) {

                    mHandler.postDelayed(new Runnable() {

                        @Override
                        public void run() {
                            NotificationCompat.Builder builder = new NotificationCompat.Builder(
                                    getActivity().getApplicationContext());
                            int id = 0;
                            final int MAX_NOTIFICATIONS = 50;
                            Random r = new Random();
                            id = 10000 + r.nextInt(MAX_NOTIFICATIONS);
                            builder.setContentTitle("TEST");
                            builder.setOngoing(false);
                            builder.setDefaults(Notification.DEFAULT_SOUND);
                            builder.setContentText("TEST TEXT " + id);
                            builder.setSmallIcon(R.drawable.ic_notification);
                            NotificationManager mgr = (NotificationManager) getActivity()
                                    .getSystemService(Context.NOTIFICATION_SERVICE);
                            mgr.notify(id, builder.build());
                        }

                    }, 5000);

                    return true;
                }
            });

    if (!ConstantHolder.getIsDebug()) {
        Preference debugCat = findPreference("debug_cat");
        getPreferenceScreen().removePreference(debugCat);
    }
}

From source file:vn.easycare.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *///  w  ww  . j a  v a2 s.c o m
private void generateNotification(Context context, String message) {
    int icon = R.drawable.ic_launcher;
    long when = 0;//System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, NotificationReceivingActivity.class);

    // set intent so it does not start a new activity
    //         notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent intent = PendingIntent.getActivity(context, (int) when, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    notification.flags |= Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify((int) when, notification);

}

From source file:uk.org.rivernile.edinburghbustracker.android.alerts.ProximityAlertReceiver.java

/**
 * {@inheritDoc}//from   ww w  .ja  v a 2s.  co  m
 */
@Override
public void onReceive(final Context context, final Intent intent) {
    final SettingsDatabase db = SettingsDatabase.getInstance(context);
    final String stopCode = intent.getStringExtra(ARG_STOPCODE);
    // Make sure the alert is still active to remain relevant.
    if (!db.isActiveProximityAlert(stopCode))
        return;

    final String stopName = BusStopDatabase.getInstance(context).getNameForBusStop(stopCode);

    final NotificationManager notMan = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    final LocationManager locMan = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    // Delete the alert from the database.
    db.deleteAllAlertsOfType(SettingsDatabase.ALERTS_TYPE_PROXIMITY);

    // Make sure the LocationManager no longer checks for this proximity.
    final PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0);
    locMan.removeProximityAlert(pi);

    final String title = context.getString(R.string.proxreceiver_notification_title, stopName);
    final String summary = context.getString(R.string.proxreceiver_notification_summary,
            intent.getIntExtra(ARG_DISTANCE, 0), stopName);
    final String ticker = context.getString(R.string.proxreceiver_notification_ticker, stopName);

    final SharedPreferences sp = context.getSharedPreferences(PreferencesActivity.PREF_FILE, 0);

    // Create the notification.
    final NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context);
    notifBuilder.setAutoCancel(true);
    notifBuilder.setSmallIcon(R.drawable.ic_status_bus);
    notifBuilder.setTicker(ticker);
    notifBuilder.setContentTitle(title);
    notifBuilder.setContentText(summary);
    // Support for Jelly Bean notifications.
    notifBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(summary));

    final Intent launchIntent;
    if (GenericUtils.isGoogleMapsAvailable(context)) {
        // The Intent which launches the bus stop map at the selected stop.
        launchIntent = new Intent(context, BusStopMapActivity.class);
        launchIntent.putExtra(BusStopMapActivity.ARG_STOPCODE, stopCode);
    } else {
        launchIntent = new Intent(context, BusStopDetailsActivity.class);
        launchIntent.putExtra(BusStopDetailsActivity.ARG_STOPCODE, stopCode);
    }

    notifBuilder
            .setContentIntent(PendingIntent.getActivity(context, 0, launchIntent, PendingIntent.FLAG_ONE_SHOT));

    final Notification n = notifBuilder.build();
    if (sp.getBoolean(PreferencesActivity.PREF_ALERT_SOUND, true))
        n.defaults |= Notification.DEFAULT_SOUND;

    if (sp.getBoolean(PreferencesActivity.PREF_ALERT_VIBRATE, true))
        n.defaults |= Notification.DEFAULT_VIBRATE;

    if (sp.getBoolean(PreferencesActivity.PREF_ALERT_LED, true)) {
        n.defaults |= Notification.DEFAULT_LIGHTS;
        n.flags |= Notification.FLAG_SHOW_LIGHTS;
    }

    // Send the notification to the UI.
    notMan.notify(ALERT_ID, n);
}

From source file:it.polimi.guardian.authorityapp.GcmIntentService.java

private void sendNotification(String msg) {
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    String[] data = msg.split("&");
    Event ev = new Event();
    ev.setLat(Double.parseDouble(data[1]));
    ev.setLng(Double.parseDouble(data[2]));
    ev.setDescription(data[3]);//from   w  w w . jav a2  s.  c om
    ev.setEvent_time(data[4]);
    ev.setLocation_acc(Float.parseFloat(data[5]));
    ev.setType_of_event(data[6]);
    ev.setUser_phone(data[7]);
    ev.setAnonymous(Integer.parseInt(data[8]));
    ev.setAddress(data[9]);

    String anonymous = "";
    if (ev.getAnonymous() == 1)
        anonymous = "Anonymous tip:";
    else
        anonymous = ev.getUser_phone() + " ";

    Intent notificationIntent = new Intent(getApplicationContext(), MapActivity.class);

    notificationIntent.putExtra("notificationFlag", true);
    notificationIntent.putExtra("lat", ev.getLat());
    notificationIntent.putExtra("lng", ev.getLng());
    notificationIntent.putExtra("eventDescription", ev);

    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingNotificationIntent = PendingIntent.getActivity(getApplicationContext(), 0,
            notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder mBuilder = null;
    switch (data[6]) {
    case "F":
        mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.flame_gray)
                .setDefaults(Notification.DEFAULT_SOUND).setContentTitle("Alert!")
                .setStyle(new NotificationCompat.BigTextStyle().bigText(anonymous + " " + data[3]))
                .setContentText(anonymous + " " + data[3]);
        break;
    case "P":
        mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.police_badge_gray)
                .setContentTitle("Alert!").setDefaults(Notification.DEFAULT_SOUND)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(anonymous + " " + data[3]))
                .setContentText(anonymous + " " + data[3]);
        break;
    case "E":
        mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ambulance_gray)
                .setContentTitle("Alert!").setDefaults(Notification.DEFAULT_SOUND)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(anonymous + " " + data[3]))
                .setContentText(anonymous + " " + data[3]);
        break;
    }

    mBuilder.setContentIntent(pendingNotificationIntent);
    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}

From source file:com.money.manager.ex.notifications.RecurringTransactionNotifications.java

private void showNotification(Cursor cursor) {
    CurrencyService currencyService = new CurrencyService(mContext);
    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();

    while (cursor.moveToNext()) {
        String payeeName = cursor.getString(cursor.getColumnIndex(QueryBillDeposits.PAYEENAME));
        // check if payee name is null, then put toAccountName
        if (TextUtils.isEmpty(payeeName))
            payeeName = cursor.getString(cursor.getColumnIndex(QueryBillDeposits.TOACCOUNTNAME));
        // compose text
        String line = cursor.getString(cursor.getColumnIndex(QueryBillDeposits.USERNEXTOCCURRENCEDATE)) + " "
                + payeeName + ": <b>"
                + currencyService.getCurrencyFormatted(
                        cursor.getInt(cursor.getColumnIndex(QueryBillDeposits.CURRENCYID)),
                        MoneyFactory// w  ww.  j ava 2 s . c  o  m
                                .fromDouble(cursor.getDouble(cursor.getColumnIndex(QueryBillDeposits.AMOUNT))))
                + "</b>";
        // add line
        inboxStyle.addLine(Html.fromHtml("<small>" + line + "</small>"));
    }

    NotificationManager notificationManager = (NotificationManager) getContext()
            .getSystemService(Context.NOTIFICATION_SERVICE);

    // create pending intent
    Intent intent = new Intent(getContext(), RecurringTransactionListActivity.class);
    // set launch from notification // check pin code
    intent.putExtra(RecurringTransactionListActivity.INTENT_EXTRA_LAUNCH_NOTIFICATION, true);

    PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, 0);

    // todo: Actions
    //        Intent skipIntent = new Intent(intent);
    //        //skipIntent.setAction(Intent.)
    //        PendingIntent skipPending = PendingIntent.getActivity(getContext(), 0, skipIntent, 0);
    //        Intent enterIntent = new Intent(getContext(), RecurringTransactionEditActivity.class);
    //        PendingIntent enterPending = PendingIntent.getActivity(getContext(), 0, enterIntent, 0);

    // create notification
    try {
        Notification notification = new NotificationCompat.Builder(getContext()).setAutoCancel(true)
                .setContentIntent(pendingIntent).setContentTitle(mContext.getString(R.string.application_name))
                .setContentText(mContext.getString(R.string.notification_repeating_transaction_expired))
                .setSubText(mContext.getString(R.string.notification_click_to_check_repeating_transaction))
                .setSmallIcon(R.drawable.ic_stat_notification)
                .setTicker(mContext.getString(R.string.notification_repeating_transaction_expired))
                .setDefaults(
                        Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS)
                .setNumber(cursor.getCount()).setStyle(inboxStyle)
                .setColor(mContext.getResources().getColor(R.color.md_primary))
                //                    .addAction(R.drawable.ic_action_content_clear_dark, getContext().getString(R.string.skip), skipPending)
                //                    .addAction(R.drawable.ic_action_done_dark, getContext().getString(R.string.enter), enterPending)
                .build();
        // notify
        notificationManager.cancel(ID_NOTIFICATION);
        notificationManager.notify(ID_NOTIFICATION, notification);
    } catch (Exception e) {
        Timber.e(e, "showing notification for recurring transaction");
    }
}

From source file:com.stoneapp.ourvlemoodle2.tasks.DiscussionSync.java

public void addNotification(MoodleDiscussion discussion) {
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.ourvle_iconsmall).setContentTitle("New Topic")
            .setContentText(Html.fromHtml(discussion.getName()).toString().trim());

    //creates an explicit intent for an activity in your app
    Intent resultIntent = new Intent(context, PostActivity.class);
    resultIntent.putExtra("discussionid", discussion.getDiscussionid() + "");
    resultIntent.putExtra("discussionname", discussion.getName());

    // The stack builder object will contain an artificial back stack for the
    // started Activity.
    // This ensures that navigating backward from the Activity leads out of
    // your application to the Home screen.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(PostActivity.class);

    stackBuilder.addNextIntent(resultIntent);

    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    mBuilder.setContentIntent(resultPendingIntent);
    Notification notification = mBuilder.build();

    notification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL;

    notification.defaults |= Notification.DEFAULT_SOUND;
    //notification.defaults |= Notification.DEFAULT_VIBRATE;

    NotificationManager mNotificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(discussion.getDiscussionid(), notification);
}