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

  • Home
  • SEARCH
  • 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 8586503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:19:30+00:00 2026-06-11T22:19:30+00:00

Am working in Messaging based iPhone app. I have added Beep sound to receive

  • 0

Am working in Messaging based iPhone app. I have added Beep sound to receive message from someone else. I am playing beep sound using AVAudioPlayer. My problem is when the user hearing song from someother applications in background if they receive message from my application the beep sound will be play and the background song/audio stopped not resuming.

I want to play my beep sound by pausing the background song/audio and again i have to resume that audio/song from my application. It is possible in iOS developing? Can anyone please help me?

EDITED:

This is my sample code.

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"Music";
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

    NSString *urlString = [[NSBundle mainBundle] pathForResource:@"basicsound" ofType:@"wav"];
    NSURL *audioURL = [[NSURL alloc] initWithString:urlString];
    NSError *error;
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:&error];
    [audioPlayer setDelegate:self];
    [audioPlayer prepareToPlay];

    audioSession = [AVAudioSession sharedInstance];
    [audioSession setActive:YES error:&error];
    [audioSession setCategory:AVAudioSessionCategoryPlayback error:&error];
    [audioPlayer play];    
}

-(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
    if (flag == YES) 
    {
        NSLog(@"Audio Played successfully");
        NSError *error;
        [audioSession setActive:NO error:&error];
    }
}
  • 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-11T22:19:31+00:00Added an answer on June 11, 2026 at 10:19 pm

    You cannot do this for all applications. For applications that use the iPod player in their applications:

    Assuming your application is in foreground. You can do this:

    MPMusicPlayerController *mp = [MPMusicPlayerController iPodMusicPlayer];        
    [mp stop]; // or [mp pause]
    

    This needs the MediaPlayer.framework and also #import <MediaPlayer/MediaPlayer.h>.

    Read more at MPMusicPlayerController Reference.


    For doing it through Audio Player Sessions you can use the property kAudioSessionCategory_SoloAmbientSound. Reference here.

    This is similar to AVAudioSessionCategorySoloAmbient defined in AVAudioSession class.

    Quoting from the documentation:

    When you use this category, audio from other apps is silenced.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in the iPhone messaging app. Am using coredata to store the
I'm working on a messaging app (something like WhatsApp) and I have a dilemma
I am working on Lan based interoffice messaging system. The steps in my applications
I am putting together a messaging system for a rails app I am working
I've a JMS messaging app thats reading and writing to MQ queues. The message
I have a messaging tool within the website I am currently working on. The
i am working on a messaging application for iphone , can anyone tell me
i am working on a messaging app where all messages are stored in a
I am working with a messaging application using c2dm.. I get registered my app
I'm working on a turn based board game for iPhone and eventually Android. I'm

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.