{"id":34660660,"url":"https://github.com/mgks/android-webview-fcm-sync","last_synced_at":"2026-05-08T02:18:50.763Z","repository":{"id":328880812,"uuid":"1117156752","full_name":"mgks/android-webview-fcm-sync","owner":"mgks","description":"A lightweight utility to sync FCM tokens into Android WebView cookies for targeted push notifications.","archived":false,"fork":false,"pushed_at":"2026-01-26T00:43:55.000Z","size":702,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-01T09:32:17.013Z","etag":null,"topics":["android-library","firebase","hybrid","java","kotlin-library","library","messaging","webview"],"latest_commit_sha":null,"homepage":"","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/mgks.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T23:06:07.000Z","updated_at":"2026-01-04T21:53:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mgks/android-webview-fcm-sync","commit_stats":null,"previous_names":["mgks/android-webview-fcm-sync"],"tags_count":3,"template":false,"template_full_name":"mgks/android-library-template","purl":"pkg:github/mgks/android-webview-fcm-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2Fandroid-webview-fcm-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2Fandroid-webview-fcm-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2Fandroid-webview-fcm-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2Fandroid-webview-fcm-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgks","download_url":"https://codeload.github.com/mgks/android-webview-fcm-sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2Fandroid-webview-fcm-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32763529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"online","status_checked_at":"2026-05-08T02:00:05.879Z","response_time":54,"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-library","firebase","hybrid","java","kotlin-library","library","messaging","webview"],"created_at":"2025-12-24T18:52:35.965Z","updated_at":"2026-05-08T02:18:50.753Z","avatar_url":"https://github.com/mgks.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android WebView FCM Sync\n\n[![](https://jitpack.io/v/mgks/android-webview-fcm-sync.svg)](https://jitpack.io/#mgks/android-webview-fcm-sync)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA lightweight utility to synchronize Firebase Cloud Messaging (FCM) tokens into Android WebView Cookies. This allows your server to identify the web session with the specific Android device for targeted push notifications.\n\nExtracted from the core of **[Android Smart WebView](https://github.com/mgks/Android-SmartWebView)**.\n\n\u003cimg src=\"https://github.com/mgks/android-webview-fcm-sync/blob/main/preview.gif?raw=true\" width=\"200\"\u003e\n\nWhen users log in via a WebView, your server creates a web session but has no idea which Android device it belongs to, so you cannot reliably send push notifications later. This library fixes that gap by fetching the native FCM token and injecting it as a secure cookie, allowing your server to read it on page load and cleanly link the web session ID to the correct FCM device token.\n\n## Installation\n\n**Step 1. Add JitPack**\n```groovy\nrepositories {\n    google()\n    mavenCentral()\n    maven { url 'https://jitpack.io' }\n}\n```\n\n**Step 2. Add Dependency**\n```groovy\ndependencies {\n    implementation 'com.github.mgks:android-webview-fcm-sync:1.0.0'\n    implementation 'com.google.firebase:firebase-messaging:23.4.0' // Required\n}\n```\n\n## Setup Requirements\n\nBecause this library relies on Firebase, your App must be configured for Firebase:\n\n1.  Add `google-services.json` to your `app/` folder.\n2.  Apply the Google Services plugin in your `app/build.gradle`:\n    ```groovy\n    plugins {\n        id 'com.android.application'\n        id 'com.google.gms.google-services'\n    }\n    ```\n\n## Usage\n\n```kotlin\nval fcmSync = SwvFcmSync()\nval myUrl = \"https://my-website.com\"\n\n// Call this BEFORE loading the URL (e.g. in onCreate)\nfcmSync.sync(myUrl) { token -\u003e\n    if (token != null) {\n        // Token is now in the CookieManager\n        // Safe to load the page now\n        webView.loadUrl(myUrl)\n    }\n}\n```\n\n### Configuration\n```kotlin\nval config = SwvFcmSync.Config(\n    cookieName = \"PUSH_DEVICE_ID\", // Default: FCM_TOKEN\n    syncToConsole = true           // Log actions to Logcat\n)\nfcmSync.sync(url, config)\n```\n\n## License\nMIT\n\n\u003e **{ github.com/mgks }**\n\u003e \n\u003e ![Website Badge](https://img.shields.io/badge/Visit-mgks.dev-blue?style=flat\u0026link=https%3A%2F%2Fmgks.dev) ![Sponsor Badge](https://img.shields.io/badge/%20%20Become%20a%20Sponsor%20%20-red?style=flat\u0026logo=github\u0026link=https%3A%2F%2Fgithub.com%2Fsponsors%2Fmgks)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgks%2Fandroid-webview-fcm-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgks%2Fandroid-webview-fcm-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgks%2Fandroid-webview-fcm-sync/lists"}