Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8373593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:42:56+00:00 2026-06-09T14:42:56+00:00

WhatsApp seems to always notify me with high volume when running in the background

  • 0

WhatsApp seems to always notify me with high volume when running in the background and one of my contacts (who has a custom notification sound) comes up.

I’m trying to create a similar effect. I want to control the volume of the notification.

The only example I could find on Stack Overflow is this.

The differences here are that:

  1. My context is a BroadcastReceiver
  2. I am not streaming music but using a notification sound based on a list of default ringtones available on the phone (similar to WhatsApp).

The notification manager is based on getSystemService(Context.NOTIFICATION_SERVICE) so some of the method available normally for streaming does not seems to be available.

Could anyone shed some light. Code:

public class OnAlarmReceiver extends BroadcastReceiver {
private static final int NOTIFY_ME_ID=1337;

private static final String TAG = "OnAlarmReceiver";

@Override
public void onReceive(Context ctxt, Intent intent) {    
    Bundle bundle = intent.getExtras();
    int itemId = bundle.getInt("itemId");
    String itemTitle = bundle.getString("itemTitle");
    int priority = bundle.getInt("priority");
    long listId = bundle.getLong("listId");
    String listTitle = bundle.getString("listTitle");

    Toast.makeText(ctxt, "itemId: " + Integer.toString(itemId), Toast.LENGTH_LONG).show();

    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ctxt);
    boolean useNotification=prefs.getBoolean("use_notification", true);

    if (useNotification) {
        NotificationManager mgr = (NotificationManager)ctxt.getSystemService(Context.NOTIFICATION_SERVICE);                                 
        Notification notification = new Notification();         
        if (priority == 1) { // Display red icon
            notification=new Notification(R.drawable.nuvola_apps_kwrite, itemTitle, System.currentTimeMillis());    
        } else { // Display blue icon
            notification=new Notification(R.drawable.nuvola_apps_package_editors, itemTitle, System.currentTimeMillis());               
        }           
        Intent itemEditor = new Intent(ctxt, EditItem.class);
        long lAlarmId = (long) (int) itemId;
        itemEditor.putExtra(DbAdapter.KEY_ITEMS_ITEM_ID, lAlarmId);
        itemEditor.putExtra("listId", listId);
        itemEditor.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        PendingIntent i=PendingIntent.getActivity(ctxt, 0, itemEditor, PendingIntent.FLAG_UPDATE_CURRENT);          
        notification.setLatestEventInfo(ctxt, listTitle, itemTitle, i);         
        String notifyPreference = prefs.getString("notification_sound", "DEFAULT_RINGTONE_URI");                        
        notification.sound = Uri.parse(notifyPreference);

        if (priority == 1) {
            notification.defaults |= Notification.DEFAULT_VIBRATE;
        }           
        mgr.notify(itemId + NOTIFY_ME_ID, notification);
    }
    else {
        Intent i=new Intent(ctxt, AlarmActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctxt.startActivity(i);
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:42:58+00:00Added an answer on June 9, 2026 at 2:42 pm

    Hmm, did you try this? (yes its using an audio stream but it should work)

    private AudioManager mAudioManager;
    private Context ctxt;
    
    mAudioManager = (AudioManager)ctxt.getSystemService(Context.AUDIO_SERVICE);
    
    int streamVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
    
    mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, streamVolume, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am building an application which has a bar just like the whatsapp
Im about to develop notifications for my app. In whatsapp you can receive group
I'm working on a messaging app (something like WhatsApp) and I have a dilemma
I would like make an app like whatsapp but i dont know how to
You might used whatsapp or LINE from iOS or Android smartphone. You need to
My app should be able to send the text in a TextView via WhatsApp,
I have 1000 HTML documents, which inside I have $contenido=<p>TFJFA<div>whatsapp</div></p><p>second parragraph</p><p>third parragraph </p><p>night</p>; I
I want to know how can get the name of the country for who
I'm triying to start whatsapp with an android intent: String uri = smsto:+123456; Intent
I'm developing a messaging app (something like WhatsApp), users can send text and image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.