{"id":23372766,"url":"https://github.com/kdroidfilter/androidcontextprovider","last_synced_at":"2025-10-13T06:17:46.482Z","repository":{"id":261361491,"uuid":"884081899","full_name":"kdroidFilter/AndroidContextProvider","owner":"kdroidFilter","description":"Android Context Provider is a simple utility library that allows you to easily access the application context from anywhere in your app. This can be especially useful for situations where accessing the context in a static manner is needed.","archived":false,"fork":false,"pushed_at":"2024-12-08T21:26:30.000Z","size":117,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-30T10:01:54.062Z","etag":null,"topics":["android","android-contentprovider","android-library","android-utilities","android-utility","android-utils","android-utils-library","context","kotlin-android"],"latest_commit_sha":null,"homepage":"https://central.sonatype.com/artifact/io.github.kdroidfilter/androidcontextprovider","language":"Kotlin","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/kdroidFilter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-06T05:24:16.000Z","updated_at":"2025-01-12T18:30:08.000Z","dependencies_parsed_at":"2024-11-06T06:28:06.552Z","dependency_job_id":"b6fea300-5dcf-42dd-80b1-88f7eb53b4f1","html_url":"https://github.com/kdroidFilter/AndroidContextProvider","commit_stats":null,"previous_names":["kdroidfilter/androidcontextprovider"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kdroidFilter/AndroidContextProvider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdroidFilter%2FAndroidContextProvider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdroidFilter%2FAndroidContextProvider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdroidFilter%2FAndroidContextProvider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdroidFilter%2FAndroidContextProvider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdroidFilter","download_url":"https://codeload.github.com/kdroidFilter/AndroidContextProvider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdroidFilter%2FAndroidContextProvider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013956,"owners_count":26085429,"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-13T02:00:06.723Z","response_time":61,"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":["android","android-contentprovider","android-library","android-utilities","android-utility","android-utils","android-utils-library","context","kotlin-android"],"created_at":"2024-12-21T16:49:30.453Z","updated_at":"2025-10-13T06:17:46.462Z","avatar_url":"https://github.com/kdroidFilter.png","language":"Kotlin","readme":"# 🔧 Android Context Provider\n\nAndroid Context Provider is a simple utility library that allows you to easily access the application context from anywhere in your app. This can be especially useful for situations where accessing the context in a static manner is needed.\n\n## ✨ Features\n\n- 🛠️ Uses 0 dependencies, making it lightweight and easy to integrate.\n\n- 💪 Easy initialization with your application context.\n\n- 🎮 Access the application context from any part of your code.\n\n## 📃 Getting Started\n\n### 🔍 Installation\n\nThe library is available on Maven Central.\n\nTo import it into your project, add the following to your `build.gradle.kts` file:\n\n```kotlin\nimplementation(\"io.github.kdroidfilter:androidcontextprovider:1.0.1\")\n```\n\nor in Groovy :\n```groovy\nimplementation 'io.github.kdroidfilter:androidcontextprovider:1.0.1'\n```\n\n### ⏳ Usage\n\n1. **✨ Automatic Initialization**\n   The `ContextProvider` is automatically initialized using a `ContentProvider`, which means you do not need to explicitly initialize it in your `Application` class. This reduces boilerplate and ensures that the `ContextProvider` is ready to use as soon as your app launches.\n\n2. **🔎 Getting the Context**\n\n   You can access the application context (not an activity context) from anywhere in your app like this:\n   ```kotlin\n   val context = ContextProvider.getContext()\n   // Use the context as needed\n   ```\n   or in Java :\n   ```java\n   Context context = ContextProvider.getContext();\n   // Use the context as needed\n   ```\n\n### ⚠️ Important Notes\n\n- **Automatic Initialization**: The `ContextProvider` is initialized automatically via `ContentProvider`, eliminating the need for manual setup.\n- **Error Handling**: If you try to get the context before it is initialized, `ContextProvider` will throw an `IllegalStateException`. However, with automatic initialization, this scenario is unlikely.\n\n## 📚 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🌐 Contributions\n\nContributions are welcome! If you find any issues or have improvements to suggest, feel free to open an issue or a pull request on GitHub.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdroidfilter%2Fandroidcontextprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdroidfilter%2Fandroidcontextprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdroidfilter%2Fandroidcontextprovider/lists"}