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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:19:02+00:00 2026-05-19T23:19:02+00:00

Regarding iPad events, how to determine if/when the iPad is changing from an awake

  • 0

Regarding iPad events, how to determine if/when the iPad is changing from an awake state to a standby state?

What I would like to do is put my Mobile-Safari web app in a locked state whenever the iPad becomes inactive/standby and ask for a PIN when it becomes awake again.

  • 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-19T23:19:02+00:00Added an answer on May 19, 2026 at 11:19 pm

    I agree that there really ought to be some signal you can hook on to to know when an application goes to sleep and when it wakes up, but you should be able to figure out when Safari wakes up indirectly.

    When the webview goes into the background, Safari puts everything in it to sleep. It pauses any video, defers network request, stops updating the UI and pauses all setInterval/setTimeout operations. JS itself will never be aware (as far as I can tell) how these things happened, but it can tell that it has happened. The simplest way to use this is to build a regularly invoked method and check to see if it’s been an unexpectedly LONG time since the last update. If you expect something to update every 10 seconds and it’s been five minutes, you can be fairly sure that the device has woken up. Here’s a quick example I thought up:

        var intTime = new Date().getTime();
        var getTime = function() {
            var intNow = new Date().getTime();
            if (intNow - intTime > 1000) {
                console.log("I JUST WOKE UP")
            }
            intTime = intNow;
            setTimeout(getTime,500);
        };
        getTime();
    

    This will detect when the user has returned from another tab, has dismissed the developer console or brought back Safari from the background. I’ve set the interval at half a second; you could set it at anything you need, though I think very low values will have concurrency issues and probably will burn the battery down on the device unnecessarily.

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

Sidebar

Related Questions

When viewing a web site on a mobile device (iPad, Galaxy Tab) there's always
I have a question regarding the new iPad 3 and iBooks. I'm trying to
I'm about to submit my first iPad app, and I have 2 questions regarding
I am having an issue regarding rotation of a pdf document in ipad. Have
I have a question regarding the UIActionSheet on the iPad. When I present an
Is there any good example/tutorial sites where I can refer to regarding building website/web
I would like to know what is the name of the functionality that is
I am porting a game from iPad to Mac. Every time I start the
I have a question regarding development for Ipad. Is there an advantage to develop
I have been using jquery mobile for developing a restaurant e-menu for ipad and

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.