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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:02:56+00:00 2026-05-26T14:02:56+00:00

I am designing an android app that needs to play a sound every minute

  • 0

I am designing an android app that needs to play a sound every minute while in its active state.

I have the logic that plays the sound every minute in the active state using a runnable and handler. The app works fine if you press the start or stop buttons.

If you run the app and hit stop it kills the app. If you run the app hit home the sounds continue to play and when you relaunch the timer will be up to date. This is expected.

The problem i am having is that if you hit home and then launch another app, there is a high chance my app gets killed and the sounds will no longer play (and consequently GUI will is reset when you relaunch)

My question is, What approach should i use so that my app will continue to play the sounds until i tell it to stop, even if its not in the foreground? The sounds can be thought of as a reminder to the user.

I have tried using the google machine to help me out but am having no luck.

  • 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-26T14:02:56+00:00Added an answer on May 26, 2026 at 2:02 pm

    If you run the app hit home the sounds continue to play and when you relaunch the timer will be up to date. This is expected.

    Except that it won’t last.

    The problem i am having is that if you hit home and then launch another app, there is a high chance my app gets killed and the sounds will no longer play (and consequently GUI will is reset when you relaunch)

    Correct.

    What approach should i use so that my app will continue to play the sounds until i tell it to stop, even if its not in the foreground?

    A service. With a period of one minute, you’re on the borderline between where I think you should use AlarmManager and an IntentService and where your existing Handler approach can work.

    You should use startForeground() with the service, both to keep Android from shutting it down, and to give the user a really easy way to get back to the activity to shut the thing up (via the Notification you establish via startForeground()).

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

Sidebar

Related Questions

We're designing an Android app that has several activities which are working in a
I am designing an app in xml android. I have been using lots of
I'm designing a music player app for Android that will feature pop-up controls. I'm
I am designing an app that will have some activities separated in tabs. Some
As part of my final year project, I'm designing an Android application that needs
I am designing something that will have a homepage close to the Google+ android
We're designing an Android app that has a lot of data (customers, products, orders...),
I'm defining a style XML for my android app. I have some TTF files
While designing a table my colleague here says that I should avoid identity column
I am designing an Android app and I'm having a couple of layout issues.

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.