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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:58:41+00:00 2026-06-10T08:58:41+00:00

I am making a running app. A timer starts when i start a run.

  • 0

I am making a running app. A timer starts when i start a run. My activity starts from beginning when i unlock my phone screen. I know that i can save my objects state using onSaveInstanceState() but How can i keep the timer running when my phone screen is locked? Whats the best way to do that? Thanks in advance.

  • 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-10T08:58:43+00:00Added an answer on June 10, 2026 at 8:58 am

    Best solution depends on what are you planning to do. You can create a service with that timer, which will continue running even after onPause().
    Or if you need it just to know how much time has elapsed, I would reccomend creating a timestamp at the start of run and comparing it ti current time whenever you need.

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

Sidebar

Related Questions

I am writing and app that has a running timer (updates the UI every
I know that when your Google App Engine (GAE) app has 0 instances running
I'm making HAML/SASS changes for a Rails app which I'm running locally using a
I have a WPF app that from time to time needs to perform a
I have a Django app that needs to pull the follower_count information from several
I am making a social app which obtains data from Facebook and displays it
Good afternoon. I have been making a small openGL based app for android that
I am making an iPhone count down app and need to know how many
I am making a iPhone/iPad app with a cursor and music. I am running
I am making a small app that deletes log files. I am using an

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.