3akare/grid-sensing
Detect power cuts from phones' charging state. The Android charging-sensor pattern (JobScheduler stop as the signal), the Poisson detection engine with its tested numbers, and per-maker battery steps (Tecno, Infinix, itel, Samsung, Xiaomi, Pixel) that stop the OS killing a background sensor. Patterns from the Outage project.
Decide from many phones' charging events whether grid power is out, with a Poisson test on simultaneous drops, and when it came back. Use when designing or testing a blackout or power-cut detector from crowd sensors, choosing a baseline rate and thresholds, computing the minimum number of simultaneous unplugs for an alert, defining restore evidence that ignores generators and inverters, or writing property-based tests (fast-check) for such an engine.
Design and review an Android sensor that detects mains power loss from the phone's charging state, using a JobScheduler job with a charging constraint whose stop is the signal. Use when building or debugging a charging-stop or unplug detector, handling job stop reasons, plug types, battery-full cases, monotonic event time, reboots and process death, a foreground-service receiver for phones that sit at 100%, or a native alarm that rings offline when power returns.
Exact per-maker steps to stop the phone from killing a background sensor app, for Tecno, Infinix, itel, Samsung, Xiaomi (Redmi, POCO) and Google Pixel. Use when writing an onboarding battery screen, adding or verifying a maker's steps, answering why a background app stops on a Tecno, Infinix or itel phone, or when low armed time shows up on one phone maker.