How to have custom notification sound android

Firstly make the folder in Resource (res) name it raw and put the file (YOUR_SOUND_FILE.MP3) in it and than use below lines of code for custom sound

   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,
            SlidingMenuActivity.class);
    notificationIntent.putExtra("isInbox", true);
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
            | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0,
            notificationIntent, 0);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

Use these lines of code for custom sound

 notification.sound =Uri.parse("android.resource://"+context.getPackageName()+"/"+R.raw.FILE_NAME);//Here is FILE_NAME is the name of file that you want to play


    // Vibrate if vibrate is enabled
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    notificationManager.notify(0, notification);

EDIT UPDATE

For the Oreo and higher , you need to check the SDK_VERSION and use the setSound method of the NotificationChannel

Notification sounds are definitely useful, but they can start to get on your nerves after a while. If you’re getting tired of your current notification sound, don’t worry – it’s easy to change it. 

Luckily, there are plenty of options to choose from, and you can even add your own sounds and customize each app individually. This article will explain how you can change the default notification sound and add your own sounds on your Android device. 

Table of Contents

How to have custom notification sound android

How to Change the Default Notification Sound on Android

The method for changing the default sound depends on your phone model and which version of Android you’re using. For that reason, we’ll describe the process for Google Pixel, Samsung Galaxy, and OnePlus below. 

To change your default Android notification sound on a Google Pixel:

  1. Open Settings. 
  2. Select Sound and vibration.

How to have custom notification sound android

  1. Tap Default notification sound.

How to have custom notification sound android

  1. You should now be able to scroll through the ringtones available by default on your Pixel. Simply tap one to set it to active. 

How to have custom notification sound android

To change the default Android notification sound on a Samsung Galaxy: 

  1. Open Settings.
  2. Tap Sounds and vibration.

How to have custom notification sound android

  1. Tap Notification sound. 

How to have custom notification sound android

  1. You should now be able to scroll through the various tones available on your Samsung device. Then, simply tap one to activate it. 

How to have custom notification sound android

To change the default Android notification settings on a OnePlus device:

  1. Open Settings.
  2. Tap Sounds & vibration.
  3. Tap Notification sound and vibration.
  4. You should now see a list of available noises. Tap one to select it as your active sound. 

Note: In these menus, you’re also able to change your default ringtone as well as the system sound option. 

How to Change the Default Notification Sound by App

Android phones allow you to change notification sounds for each app individually. This is useful if you’d like a specific app notification sound for different apps (for example, the WhatsApp messenger or text messages app).

To change the default notification tone of an app: 

  1. Open Settings > Apps (you may have to select Your apps depending on your device).

How to have custom notification sound android

  1. Select the app you want, for instance, Gmail.

How to have custom notification sound android

  1. Tap Notifications.

How to have custom notification sound android

  1. Toggle on Show notifications if it isn’t already. 

How to have custom notification sound android

  1. Scroll down to the category you want to change. If you want to change the default notification sound for one of your email accounts, select Email under that account. 

How to have custom notification sound android

  1. Select Sound.

How to have custom notification sound android

  1. You should now be able to choose your new sound from the list. 

How to Set a Custom Alert Sound in Settings

Maybe the default alert sounds just aren’t good enough, or maybe you want a particular sound for your notifications. Either way, Android’s system settings let you use your own notification sounds. 

There are two main ways of doing this – using a free ringtone and sounds app such as Zedge, or manually. 

How to Use Zedge to Set a Custom Notification Sound

Zedge is the easiest way to find and download different notification sounds. To use Zedge: 

  1. Open the Google Play Store, and search for Zedge.
  2. Tap Install. 

How to have custom notification sound android

  1. Once it’s installed, tap Open and give it the necessary permissions.

How to have custom notification sound android

  1. Tap the three horizontal lines at the top-left of the screen. 

How to have custom notification sound android

  1. Select Notification Sounds (you can also change your ringtones here). 

How to have custom notification sound android

  1. Scroll through the sounds until you find one you like, then hit the download button. 
  2. In the pop-up menu, select either Set Notification to set it automatically.

How to Manually Set a Custom Notification Sound

To manually set a custom notification sound, you need to download or create an MP3 file and ensure it’s in the correct folder. To do this, you need to use Android’s File Manager or any third-party alternatives. Then you need to set that MP3 file as your default sound.

If you’d like to create your own sound file, you can record sounds using an app such as Voice Recorder. You’re then able to cut this into a smaller soundbite appropriate for the notification sound using another app such as MP3 Cutter & Ringtone Cutter. 

Alternatively, you can use another app to make a synth beat or whatever sound you like. 

Once you have the audio file, you need to do the following:

  1. Open File Manager (or My Files depending on your device) and navigate to your MP3 file. Most likely, you will find this in Audio > Music. If you downloaded the file, it may be in Downloads. 

How to have custom notification sound android

  1. Tap and hold the MP3 file and select Move.

How to have custom notification sound android

  1. You then need to navigate back to Internal Storage in My Files. 

How to have custom notification sound android

  1. Scroll down and tap the Notifications folder. 

How to have custom notification sound android

Note: If Notifications isn’t visible, tap the dropdown arrow at the top-left of the screen and select All. 

How to have custom notification sound android

  1. Tap Move here. 

How to have custom notification sound android

  1. Open the Settings app and navigate to the Notification sound setting (on Samsung, tap Sounds and vibration. On Pixel, tap Apps & Notifications > Notifications). 

How to have custom notification sound android

  1. Select Notification sound (Default notification sound on Pixel).

How to have custom notification sound android

  1. Your MP3 file should be present under Custom. 

How to have custom notification sound android

Get Notifications Your Way

Notifications seem never to cease, whether it’s from social media or a game. And this is where Android’s customization options come in handy. Personalizing your notifications is a great way to add your touch to your phone and avoid getting sick of hearing the same tune over and over again. 

Can I add my own notification sound?

Here's how to manually add a custom sound to your settings. Go to Settings > Apps & notifications > Notifications. Scroll down and tap Advanced > Default notification sound. Tap My Sounds.

How do I add custom sounds to my Samsung?

You can import audio by downloading sounds to your phone and using the My Files app to copy them to the Notifications folder. You can create a unique notification for every app on your Samsung phone by customizing Notifications in the app's Info page.

How do I add notification sounds to my Android 2022?

Here's how you can set custom notification sounds for all the text messages on your Android device:.
Open the default messaging app..
Open “Menu” and click on “Settings.”.
Choose “Notifications” and then click on “sound.”.
From the options, select your preferred tone..

Can you change notification sounds for different Apps?

On your device, navigate to Settings > Apps > Your apps. The menu names may be slightly different on some devices—for this guide, we'll be using a Samsung device. Find the app you wish to set a custom tone for and select it. On the app info page, tap Notifications and toggle on the slider button for Show notifications.