{"id":32293487,"url":"https://github.com/mrrhak/screen_lock_detector","last_synced_at":"2026-02-21T07:37:24.665Z","repository":{"id":318734758,"uuid":"1075223691","full_name":"mrrhak/screen_lock_detector","owner":"mrrhak","description":"A Flutter plugin that enables your app to detect screen lock and unlock events across Android and iOS platforms.  The plugin provides native event callbacks for both Android and iOS, making it easy to respond to lock screen changes — such as pausing sensitive activities, logging out users, or triggering background operations.","archived":false,"fork":false,"pushed_at":"2025-10-14T06:32:55.000Z","size":1160,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-14T07:12:46.350Z","etag":null,"topics":["device-lock","lockscreen","screen-lock","screen-lock-detector"],"latest_commit_sha":null,"homepage":"https://mrrhak.com","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrrhak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"mrrhak","custom":["https://www.buymeacoffee.com/mrrhak"]}},"created_at":"2025-10-13T07:58:23.000Z","updated_at":"2025-10-14T07:01:32.000Z","dependencies_parsed_at":"2025-10-14T07:13:07.864Z","dependency_job_id":"50e7c98d-29fe-48db-ab91-b09ff0d8ff21","html_url":"https://github.com/mrrhak/screen_lock_detector","commit_stats":null,"previous_names":["mrrhak/screen_lock_detector"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mrrhak/screen_lock_detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrrhak%2Fscreen_lock_detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrrhak%2Fscreen_lock_detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrrhak%2Fscreen_lock_detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrrhak%2Fscreen_lock_detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrrhak","download_url":"https://codeload.github.com/mrrhak/screen_lock_detector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrrhak%2Fscreen_lock_detector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280554555,"owners_count":26350212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["device-lock","lockscreen","screen-lock","screen-lock-detector"],"created_at":"2025-10-23T03:33:00.377Z","updated_at":"2025-10-23T03:33:03.867Z","avatar_url":"https://github.com/mrrhak.png","language":"Dart","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\" style=\"font-size: 50px;\"\u003e🪴 Screen Lock Detector 🪴\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cp align=\"center\"\u003e\nA Flutter plugin that enables your app to detect screen lock and unlock events across Android and iOS platforms.\n\nThe plugin provides native event callbacks for both Android and iOS, making it easy to respond to lock screen changes — such as pausing sensitive activities, logging out users, or triggering background operations.\n\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n   \u003c!--  Donations --\u003e\n  \u003ca href=\"https://ko-fi.com/mrrhak\"\u003e\n    \u003cimg width=\"300\" src=\"https://user-images.githubusercontent.com/26390946/161375567-9e14cd0e-1675-4896-a576-a449b0bcd293.png\"\u003e\n  \u003c/a\u003e\n  \u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://www.buymeacoffee.com/mrrhak\"\u003e\n      \u003cimg width=\"150\" alt=\"buy me a coffee\" src=\"https://user-images.githubusercontent.com/26390946/161375563-69c634fd-89d2-45ac-addd-931b03996b34.png\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://ko-fi.com/mrrhak\"\u003e\n      \u003cimg width=\"150\" alt=\"Ko-fi\" src=\"https://user-images.githubusercontent.com/26390946/161375565-e7d64410-bbcf-4a28-896b-7514e106478e.png\"\u003e\n    \u003c/a\u003e\n  \u003c/div\u003e\n  \u003c!--  Donations --\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://pub.dartlang.org/packages/screen_lock_detector\"\u003e\n    \u003cimg src=\"https://img.shields.io/pub/v/screen_lock_detector?label=Pub\u0026logo=dart\"\n      alt=\"Pub Package\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/screen_lock_detector\"\u003e\n    \u003cimg src=\"https://img.shields.io/pub/likes/screen_lock_detector?style=flat\u0026logo=dart\u0026label=Likes\" alt=\"Pub Likes\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dartlang.org/packages/screen_lock_detector/score\"\u003e\n    \u003cimg src=\"https://img.shields.io/pub/points/screen_lock_detector?label=Score\u0026logo=dart\"\n      alt=\"Pub Score\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/screen_lock_detector\"\u003e\n    \u003cimg alt=\"Pub Monthly Downloads\" src=\"https://img.shields.io/pub/dm/screen_lock_detector?style=flat\u0026color=blue\u0026logo=dart\u0026label=Downloads\u0026link=https%3A%2F%2Fpub.dev%2Fpackages%2Fscreen_lock_detector\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mrrhak/screen_lock_detector\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/mrrhak/screen_lock_detector.svg?style=flat\u0026logo=github\u0026colorB=deeppink\u0026label=Stars\" alt=\"Star on Github\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/mrrhak/screen_lock_detector\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/mrrhak/screen_lock_detector?color=orange\u0026label=Forks\u0026logo=github\" alt=\"Forks on Github\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/mrrhak/screen_lock_detector/graphs/contributors\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/contributors/mrrhak/screen_lock_detector.svg?style=flat\u0026logo=github\u0026colorB=yellow\u0026label=Contributors\"\n      alt=\"Contributors\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mrrhak/screen_lock_detector/actions?query=workflow%3A\"\u003e\n    \u003cimg src=\"https://github.com/mrrhak/screen_lock_detector/actions/workflows/format-analyze-test.yml/badge.svg\"\n      alt=\"Build Status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mrrhak/screen_lock_detector\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/languages/code-size/mrrhak/screen_lock_detector?logo=github\u0026color=blue\u0026label=Size\"\n      alt=\"Code size\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/screen_lock_detector\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Platform-Android%20|%20iOS%20-blue.svg?logo=flutter\"\n      alt=\"Platform\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/mrrhak/screen_lock_detector/master/assets/screen_lock_detector_preview.png\" width=\"500\" alt=\"screen lock detector preview\"/\u003e\n\u003c/p\u003e\n\n## How it's work?\nFor iOS, this plugin just listen to `UIApplication` notification center API:\n- `protectedDataWillBecomeUnavailableNotification` to detect is **locked**\n- `protectedDataDidBecomeAvailableNotification` to detect is **unlocked**\n\nFor Android, this plugin uses `KeyguardManager` and `PowerManager` API to check if device is secured lock or display is off combine with listener on `Intent` actions:\n- `ACTION_SCREEN_OFF` to detect is **locked**\n- `ACTION_USER_PRESENT` to detect is **unlocked**\n\n\n## Features\n- ✅ Detect when the screen is locked.\n- ✅ Detect when the screen is unlocked.\n- ✅ Supports both event streams and manual status checks.\n- ✅ Works on Android and iOS.\n\n\u003e **Note**\n\u003e This plugin does not work on simulators or emulators because it relies on native system events that are not available in these virtual environments. Please test on a physical device.\n\n\n## Installation\nAdd `screen_lock_detector` as a dependency in your `pubspec.yaml` file:\n```sh\nflutter pub add screen_lock_detector\n```\n\n## Usage\n### Import Plugin\n```dart\nimport 'package:screen_lock_detector/screen_lock_detector.dart';\n```\n\n### Listen to Event Stream\n```dart\nScreenLockDetector.statusStream.listen((status) {\n    print(\"Screen status: $status\");\n    if (status == ScreenStatus.locked) {\n    // Do something here when screen is locked\n    } else if (status == ScreenStatus.unlocked) {\n    // Do something here when screen is unlocked\n    }\n});\n```\n\n### Or Manual Status Check\n```dart\nfinal status = await ScreenLockDetector.checkScreenStatus();\nprint(\"Screen status: $status\");\n```\n\nSee the [example](https://github.com/mrrhak/screen_lock_detector/tree/master/example) for runnable examples of various usages.\n\n## Bugs or Requests\n\nIf you encounter any problems feel free to open an [issue](https://github.com/mrrhak/screen_lock_detector/issues/new?template=bug_report.md). If you feel the library is missing a feature, please raise a [ticket](https://github.com/mrrhak/screen_lock_detector/issues/new?template=feature_request.md) on GitHub and I'll look into it. Pull request are also welcome.\n\nSee [Contributing.md](https://github.com/mrrhak/screen_lock_detector/blob/master/CONTRIBUTING.md).\n\n## Support\nDon't forget to give it a like 👍 or a star ⭐\n\n## Activities\n![Alt](https://repobeats.axiom.co/api/embed/35602a25c897379cbb5233a066c030c0c082b45d.svg \"Repobeats analytics image\")","funding_links":["https://ko-fi.com/mrrhak","https://www.buymeacoffee.com/mrrhak"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrrhak%2Fscreen_lock_detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrrhak%2Fscreen_lock_detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrrhak%2Fscreen_lock_detector/lists"}