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 477989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:38:47+00:00 2026-05-13T00:38:47+00:00

My application uses a remote service to play audio. I do this so that

  • 0

My application uses a remote service to play audio. I do this so that
no activity owns the playback of the audio – the user can trigger some
audio to be played from one Activity, and the audio will continue to
play as they navigate around the app. I do, however, want to tell the
service to pause or stop playing audio when the user “unloads” the app
either by backing out, locking the display, or hitting Home. When the app was a single
activity, I was doing this in onPause. So, I guess I’m essentially
looking for “onPause” at the application/task level. Does such thing
exist? If not, what is the “best practice” way of getting notified
that the task has been put on hold by the user either backing all the
way out or hitting Home?

  • 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-05-13T00:38:47+00:00Added an answer on May 13, 2026 at 12:38 am

    Hmmmm…unfortunately, I suspect there’s no easy answer there. I think that’s why the built-in media player and Pandora use a notification, to easily let the user get back to the app to make it shut up.

    If your activity flow is fairly linear, then backing out of the application is the same as backing out of the initial activity.

    A trick I used in one scenario was to have each activity notify the service in onPause() and onResume(). The service would monitor these, and if it got an onPause() without a subsequent onResume() in some period of time, it was assumed the user was gone (HOME, incoming phone call, incoming text message, responding to some app via a notification, etc.).

    You can also watch for ACTION_SCREEN_OFF broadcast Intents, to handle that scenario.

    I am sorry that I don’t have a better silver bullet answer — perhaps somebody else will have a better idea.

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

Sidebar

Related Questions

My application uses some session variables that are timing out even though I thought
I have a client side application that uses Kerberos authentication to connect to remote
Our application uses a large product database that is updated once a day. Updates
My ClickOnce application uses a third party tool that requires the Visual C++ 2005
My client application uses a boost::asio::ip::tcp::socket to connect to a remote server. If the
I am writing an application which uses web services to connect a remote server.I
I've got a local application (which I didn't write, and can't change) that talks
My application uses loads of Java threads. I am looking for a reliable understanding
Our application uses Hibernate for ORM, and stores data in several schemas, accessing them
My application uses the Trace object to log information. The information is captured in

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.