Git Product home page Git Product logo

Comments (2)

zach-klippenstein avatar zach-klippenstein commented on September 22, 2024

Register a listener for TIME_TICK such that, when the screen is on and portal state is needs_signin, the portal detector is fired every minute. This should be stopped whenever the screen turns off (and restarted when it's back on, if the conditions are still true), and when the portal state changes (to unknown, no_portal, or signed_in).

This differs from #3 in that the timer is only running when the portal isn't signed in.

from captivate.

zach-klippenstein avatar zach-klippenstein commented on September 22, 2024

A better solution

This allows finer-grained control over timing, and handles on SCREEN_ON cases.

Write custom version of IntentService (same API), with one change: doesn't automatically stop the service/thread when the queue is empty. The service then stops itself manually whenever state is not SIGNIN_REQUIRED or SIGNING_IN.

When it is in one of those states, schedule a refresh check every 30 seconds (using sendDelayed), unless the screen has been turned off.

When entering either of those states, or SIGNED_IN (i.e. whenever the device is on a portal), register a handler for the screen on broadcast intent. The handler should simply call startService, which will handle both of the following cases:

  1. SIGNIN_REQUIRED or SIGNING_IN: starts the update loop timer
  2. SIGNED_IN: checks if session has timed out, which is basically issue #3

from captivate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.