Example usage for android.media RingtoneManager TYPE_NOTIFICATION

List of usage examples for android.media RingtoneManager TYPE_NOTIFICATION

Introduction

In this page you can find the example usage for android.media RingtoneManager TYPE_NOTIFICATION.

Prototype

int TYPE_NOTIFICATION

To view the source code for android.media RingtoneManager TYPE_NOTIFICATION.

Click Source Link

Document

Type that refers to sounds that are used for notifications.

Usage

From source file:com.weddingsingers.wsapp.fcm.MyFirebaseMessagingService.java

/**
 * Create and show a simple notification containing the received FCM message.
 *
 * @param messageBody FCM message body received.
 *///  w w  w . j  a va2 s.  c  o  m
private void sendNotification(String messageBody, String action) {
    Intent intent = new Intent(this, SplashActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

    switch (action) {
    case ACTION_RESERVATION_LIST: {
        intent.putExtra(SplashActivity.EXTRA_FRAGNAME, MainActivity.FRAG_RESERVATION_MGM);
        break;
    }
    case ACTION_RESERVED_CUSTOMER: {
        intent.putExtra(SplashActivity.EXTRA_FRAGNAME, MainActivity.FRAG_RESERVED_CUSTOMER);
        break;
    }
    case ACTION_SCHEDULE_MGM: {
        intent.putExtra(SplashActivity.EXTRA_FRAGNAME, MainActivity.FRAG_SCHEDULE_MGM);
        break;
    }
    case ACTION_VIDEO: {
        intent.putExtra(SplashActivity.EXTRA_FRAGNAME, MainActivity.FRAG_VIDEO);
        break;
    }
    case ACTION_CHATTING: {
        intent.putExtra(SplashActivity.EXTRA_FRAGNAME, ChattingActivity.class);
        break;
    }
    }

    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.manifest_ic_wedding_singers_512).setContentTitle("FCM Message")
            .setContentText(messageBody).setAutoCancel(true).setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

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

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}

From source file:com.abajeli.wearable.gesturecadabra.MainActivity.java

public void parla(String txt) {
    //ttobj.speak(txt, TextToSpeech.QUEUE_FLUSH, null);

    try {/*from  ww w . j  a va  2 s  .  c o  m*/
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

        long[] vibrationPattern = { 0, 100, 0, 0 };
        final int indexInPatternToRepeat = -1;
        Utils.vibratePattern(this, vibrationPattern, indexInPatternToRepeat);

        //Ringtone r = RingtoneManager.getRingtone(baseContext, notification);
        //r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }

    /*
            Intent viewIntent = new Intent(mContext, NotificationActivity.class);
            viewIntent.putExtra(EXTRA_EVENT_ID, NOTIFICATION_ID);
            PendingIntent viewPendingIntent =
        PendingIntent.getActivity(mContext, 0, viewIntent, 0);
            
    // Create a WearableExtender to add functionality for wearables
            NotificationCompat.WearableExtender wearableExtender =
        new NotificationCompat.WearableExtender()
                .setHintHideIcon(true);
            //.setBackground(mBitmap);
            
    // Create a NotificationCompat.Builder to build a standard notification
    // then extend it with the WearableExtender
            NotificationCompat.Builder notificationBuilder =
        new NotificationCompat.Builder(mContext)
                //.setSmallIcon(R.drawable.ic_event)
                .setContentTitle("eventTitle")
                .setContentText("eventLocation")
                .extend(wearableExtender)
                .setContentIntent(viewPendingIntent);
            
            
            
            
            
            
            // Get an instance of the NotificationManager service
            NotificationManagerCompat notificationManager =
        NotificationManagerCompat.from(mContext);
            
    // Issue the notification with notification manager.
            notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
            
            */

}

From source file:com.android.emailcommon.provider.Account.java

public Account() {
    mBaseUri = CONTENT_URI;//w w w. j a  v  a 2s . com

    // other defaults (policy)
    mRingtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).toString();
    mSyncInterval = -1;
    mSyncLookback = -1;
    mFlags = 0;
}

From source file:com.zaparound.MyFirebaseMessagingService.java

/**
 * Create and show a simple notification containing the received FCM message.
 *
 * @param messageBody FCM message body received.
 *///  w ww . jav a  2  s  .  c  o  m
private void sendNotificationZapRequest(String messagetitle, String messageBody) {
    Intent intent = new Intent(this, LandingActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(
            Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra("CHECKIN_TAB_POS", 1);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
    Notification notification = mBuilder.setSmallIcon(R.drawable.applogo).setTicker(messagetitle).setWhen(0)
            .setAutoCancel(true).setContentTitle(messagetitle)
            //.setNumber(++count)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
            //.setSubText("\n "+count+" new messages\n")
            .setContentIntent(pendingIntent)
            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.applogo))
            .setContentText(messageBody).build();

    NotificationManager notificationManager = (NotificationManager) this
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(0, notification);
}

From source file:com.unfc.choicecustomercare.gcmservices.MyGcmListenerService.java

private void sendNotificationForTakeBreakAccept(String message, String fromId, String toId) {

    boolean loggedOut = CustomPreferences.getPreferences(Constants.PREF_LOGGED_OUT, false);
    Intent intent;/*from w  w  w .j  av a 2  s . c o m*/
    if (loggedOut) {
        intent = new Intent(this, LoginActivity.class);

    } else {
        intent = new Intent(this, MainActivity.class);
    }

    intent.setAction("takeBreakAccept");
    intent.putExtra("fromId", fromId);
    intent.putExtra("toId", toId);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);

    Intent intentAccept = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingAccept = PendingIntent.getActivity(this, 1, intentAccept, PendingIntent.FLAG_ONE_SHOT);
    //
    Intent intentDecline = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingDecline = PendingIntent.getActivity(this, 2, intentDecline,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher).setContentTitle(getString(R.string.app_name))
            .setContentText(message).setAutoCancel(true).setSound(defaultSoundUri)
            .setContentIntent(pendingIntent).setAutoCancel(true);

    notificationBuilder.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
    notificationBuilder.setAutoCancel(true);

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

    notificationManager.notify(Constants.TAKE_A_BREAK_NOTIFICATION_ID, notificationBuilder.build());

}

From source file:at.flack.receiver.FacebookReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();//from   w w w  .j  a v a  2 s.  c o  m
    try {
        if (main instanceof FbMessageOverview && bundle.getString("type").equals("message")) {
            ((FbMessageOverview) main).addNewMessage(
                    new FacebookMessage(bundle.getString("fb_name"), bundle.getString("fb_message"),
                            bundle.getString("fb_img"), bundle.getLong("fb_id"), bundle.getString("fb_tid")));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("readreceipt")) {
            ((FbMessageOverview) main).changeReadReceipt(bundle.getLong("fb_time"),
                    bundle.getLong("fb_reader"));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("typ")) {
            ((FbMessageOverview) main).changeTypingStatus(bundle.getLong("my_id"), bundle.getLong("fb_id"),
                    bundle.getBoolean("fb_from_mobile"), bundle.getInt("fb_status"));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("img_message")) {
            ((FbMessageOverview) main).addNewMessage(new FacebookImageMessage(bundle.getString("fb_name"),
                    bundle.getString("fb_image"), bundle.getString("fb_preview"), bundle.getString("fb_img"),
                    bundle.getLong("fb_id"), bundle.getString("fb_tid")));
        } else if (bundle.getString("type").equals("read")) {
            killNotification(context,
                    new MarkAsRead(bundle.getString("fb_tid"), bundle.getBoolean("fb_markas")));
        } else if (bundle.getString("type").equals("message")
                || bundle.getString("type").equals("img_message")) {
            sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
            if (!sharedPrefs.getBoolean("notification_fbs", true))
                return;
            notify = sharedPrefs.getBoolean("notifications", true);
            vibrate = sharedPrefs.getBoolean("vibration", true);
            headsup = sharedPrefs.getBoolean("headsup", true);
            led_color = sharedPrefs.getInt("notification_light", -16776961);
            boolean all = sharedPrefs.getBoolean("all_fb", true);

            if (notify == false)
                return;
            if (bundle.getLong("fb_id") == bundle.getLong("my_id")) {
                return;
            }

            NotificationCompat.Builder mBuilder = null;
            boolean use_profile_picture = false;
            Bitmap profile_picture = null;

            String origin_name = bundle.getString("fb_name");

            try {
                profile_picture = RoundedImageView.getCroppedBitmap(Bitmap.createScaledBitmap(
                        ProfilePictureCache.getInstance(context).get(origin_name), 200, 200, false), 300);
                use_profile_picture = true;
            } catch (Exception e) {
                use_profile_picture = false;
            }

            Resources res = context.getResources();

            if (bundle.getString("type").equals("img_message")) {
                bundle.putString("fb_message", res.getString(R.string.fb_notification_new_image));
            }

            int lastIndex = bundle.getString("fb_message").lastIndexOf("=");
            if (lastIndex > 0 && Base64.isBase64(bundle.getString("fb_message").substring(0, lastIndex))) {
                mBuilder = new NotificationCompat.Builder(context)
                        .setSmallIcon(R.drawable.raven_notification_icon).setContentTitle(origin_name)
                        .setColor(0xFF175ea2)
                        .setContentText(res.getString(R.string.sms_receiver_new_encrypted_fb))
                        .setAutoCancel(true);
                if (use_profile_picture && profile_picture != null) {
                    mBuilder = mBuilder.setLargeIcon(profile_picture);
                } else {
                    mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                            context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                }
            } else { // normal or handshake

                if (bundle.getString("fb_message").charAt(0) == '%'
                        && (bundle.getString("fb_message").length() == 10
                                || bundle.getString("fb_message").length() == 9)) {
                    if (lastIndex > 0
                            && Base64.isBase64(bundle.getString("fb_message").substring(1, lastIndex))) {
                        mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name)
                                .setColor(0xFF175ea2)
                                .setContentText(res.getString(R.string.sms_receiver_handshake_received))
                                .setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
                        if (use_profile_picture && profile_picture != null) {
                            mBuilder = mBuilder.setLargeIcon(profile_picture);
                        } else {
                            mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                    context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                        }
                    } else {
                        return;
                    }
                } else if (bundle.getString("fb_message").charAt(0) == '%'
                        && bundle.getString("fb_message").length() >= 120
                        && bundle.getString("fb_message").length() < 125) {
                    if (lastIndex > 0
                            && Base64.isBase64(bundle.getString("fb_message").substring(1, lastIndex))) {
                        mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name)
                                .setColor(0xFF175ea2)
                                .setContentText(res.getString(R.string.sms_receiver_handshake_received))
                                .setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
                        if (use_profile_picture && profile_picture != null) {
                            mBuilder = mBuilder.setLargeIcon(profile_picture);
                        } else {
                            mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                    context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                        }
                    } else {
                        return;
                    }
                } else if (all) { // normal message
                    mBuilder = new NotificationCompat.Builder(context)
                            .setSmallIcon(R.drawable.raven_notification_icon).setContentTitle(origin_name)
                            .setColor(0xFF175ea2).setContentText(bundle.getString("fb_message"))
                            .setAutoCancel(true).setStyle(new NotificationCompat.BigTextStyle()
                                    .bigText(bundle.getString("fb_message")));

                    if (use_profile_picture && profile_picture != null) {
                        mBuilder = mBuilder.setLargeIcon(profile_picture);
                    } else {
                        mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                    }
                } else {
                    return;
                }
            }
            // }
            Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            mBuilder.setSound(alarmSound);
            mBuilder.setLights(led_color, 750, 4000);
            if (vibrate) {
                mBuilder.setVibrate(new long[] { 0, 100, 200, 300 });
            }

            Intent resultIntent = new Intent(context, MainActivity.class);
            resultIntent.putExtra("FACEBOOK_NAME", origin_name);

            TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
            stackBuilder.addParentStack(MainActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(1,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            mBuilder.setContentIntent(resultPendingIntent);
            if (Build.VERSION.SDK_INT >= 16 && headsup)
                mBuilder.setPriority(Notification.PRIORITY_HIGH);
            if (Build.VERSION.SDK_INT >= 21)
                mBuilder.setCategory(Notification.CATEGORY_MESSAGE);

            final NotificationManager mNotificationManager = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);

            if (!MainActivity.isOnTop)
                mNotificationManager.notify(8, mBuilder.build());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.shivshankar.MyFirebaseMessagingService.java

private void sendNotification(String strTitle, String strMsg) {
    Log.d("TAGRK", "Preparing to send notification...: " + strTitle + "  Msg: " + strMsg);
    NotificationManager mNotificationManager = (NotificationManager) this
            .getSystemService(Context.NOTIFICATION_SERVICE);

    Intent intent;// ww w .j a  v  a  2 s  . com
    if (AppPreferences.getPrefs().getBoolean(commonVariables.KEY_IS_SELLER, false))
        intent = new Intent(this, MainActivitySeller.class);
    else
        intent = new Intent(this, MainActivityBuyer.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    int requestID = (int) System.currentTimeMillis();
    PendingIntent contentIntent = PendingIntent.getActivity(MyFirebaseMessagingService.this, requestID, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this).setContentTitle(strTitle)
            .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(strMsg)).setContentText(strMsg)
            .setPriority(NotificationCompat.PRIORITY_MAX).setWhen(0).setVibrate(new long[] { 100, 100, 0, 0 });

    mBuilder.setSmallIcon(R.drawable.ic_noti_fcm);
    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }

    mBuilder.setAutoCancel(true);
    if (!strMsg.contains("Your OTP is"))
        mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(NOTIFICATION_ID++, mBuilder.build());
    Log.d("TAGRK", "Notification sent successfully.");
}

From source file:crea.wallet.lite.service.CreativeCoinService.java

private void notifyCoinsReceived(Sha256Hash hash) {
    if (!Configuration.getInstance().isNotificationsEnabled()) {
        return;/*from  w w w  .ja  v  a 2s  . c o  m*/
    }

    int notificationCount = transactionsReceived.size();
    if (notificationCount == 1) {
        nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
    }

    notificationAccumulatedAmount = Coin.ZERO;
    for (Coin c : transactionsReceived.values()) {
        notificationAccumulatedAmount = notificationAccumulatedAmount.add(c);
    }

    Coin coin = Coin.valueOf(notificationAccumulatedAmount.getValue());
    String msg;
    Intent intent;

    msg = getString(R.string.notif_accumulated_amount, coin.toFriendlyString(), notificationCount);
    intent = new Intent(this, MainActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

    intent.putExtra(TransactionActivity.TRANSACTION_ID, hash.toString());

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

    String title = getString(R.string.notif_cash_in_title, coin.toFriendlyString());
    final NotificationCompat.Builder notification = new NotificationCompat.Builder(this);
    notification.setSmallIcon(R.mipmap.ic_notification);
    notification.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
    notification.setColor(getResources().getColor(R.color.colorPrimary));
    notification.setContentText(msg);
    notification.setContentTitle(title);
    notification.setWhen(System.currentTimeMillis());
    notification.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
    notification.setContentIntent(pendingIntent);
    Notification notif = notification.build();
    notif.flags |= Notification.FLAG_AUTO_CANCEL;
    nm.notify(NOTIFICATION_ID_COINS_RECEIVED, notif);
}

From source file:io.coldstart.android.GCMIntentService.java

private void sendRateLimitNotification(String rateLimitCount) {
    if (null == rateLimitCount)
        rateLimitCount = "0";

    Intent intent = new Intent(this, TrapListActivity.class);
    intent.putExtra("forceDownload", true);
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);

    Intent broadcastDownload = new Intent();
    broadcastDownload.setAction(BatchDownloadReceiver.BROADCAST_ACTION);
    PendingIntent pBroadcastDownload = PendingIntent.getBroadcast(this, 0, broadcastDownload, 0);

    Intent broadcastIgnore = new Intent();
    broadcastIgnore.setAction(BatchIgnoreReceiver.BROADCAST_ACTION);
    PendingIntent pBroadcastIgnore = PendingIntent.getBroadcast(this, 0, broadcastIgnore, 0);

    Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    Notification notification = null;

    if (Build.VERSION.SDK_INT >= 16) {
        notification = new Notification.InboxStyle(new Notification.Builder(this)
                .setContentTitle("Inbound Traps have been rate limited")
                .setContentText(//w  w  w.  j  a  va 2  s.c  o  m
                        "\"The number of traps being relayed to your phone has breeched the rate limit.")
                .setSmallIcon(R.drawable.ic_stat_ratelimit).setVibrate(new long[] { 0, 100, 200, 300 })
                .setAutoCancel(true).setSound(uri).setPriority(Notification.PRIORITY_HIGH)
                .setTicker("Inbound Traps have been rate limited")
                .addAction(R.drawable.ic_download_batch, "Get Batched Traps", pBroadcastDownload)
                .addAction(R.drawable.ic_ignore, "Ignore Batch", pBroadcastIgnore))
                        .setBigContentTitle("Inbound Traps have been rate limited")
                        .setSummaryText("Launch ColdStart.io to Manage These Events")
                        .addLine("The number of traps relayed to you has breeched the rate limit.")
                        .addLine("The current number of items queued is " + rateLimitCount).addLine(" ")
                        .addLine("Tap \"Get Batched Traps\" to download the cached traps")
                        .addLine("Tap \"Ignore Batch\" to delete them from the server.")

                        .build();
    } else {
        notification = new Notification.Builder(this).setContentTitle("Inbound Traps have been rate limited")
                .setContentText(
                        "The number of traps being relayed to your phone has breeched the rate limit. The current number of items queued is "
                                + rateLimitCount
                                + "\nTap \"Get Alerts\" to batch download the outstanding traps or tap \"Ignore\" to delete them from the server.")
                .setSmallIcon(R.drawable.ic_stat_ratelimit).setContentIntent(pIntent)
                .setVibrate(new long[] { 0, 100, 200, 300 }).setAutoCancel(true).setSound(uri).build();
    }

    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    notificationManager.notify(43524, notification);
}

From source file:com.weddingsingers.wsapp.fcm.MyFirebaseMessagingService.java

private void sendNotification(Alarm alarm, String action) {
    Intent intent = new Intent(this, SplashActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    intent.putExtra(SplashActivity.EXTRA_FRAGNAME, ChattingActivity.class);

    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.manifest_ic_wedding_singers_512).setContentTitle("FCM Message")
            .setContentText(alarm.getMessage()).setAutoCancel(true).setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

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

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}