{"id":19334981,"url":"https://github.com/isurusankhajith/fcm-push-notification-http-v1","last_synced_at":"2026-05-18T05:38:07.439Z","repository":{"id":261105992,"uuid":"883012169","full_name":"IsuruSankhajith/FCM-push-notification-http-v1","owner":"IsuruSankhajith","description":"This project demonstrates a basic implementation of Firebase Cloud Messaging (FCM) to send and receive push notifications using HTTP in an Android application. The app is built using Kotlin, Jetpack Compose, and integrates with Firebase for push notifications.","archived":false,"fork":false,"pushed_at":"2024-11-04T17:51:21.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-06T09:44:58.935Z","etag":null,"topics":["fcm-push-notification","firebase","http","kotlin-android"],"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/IsuruSankhajith.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}},"created_at":"2024-11-04T08:17:26.000Z","updated_at":"2024-11-04T17:51:24.000Z","dependencies_parsed_at":"2024-11-04T18:41:41.206Z","dependency_job_id":"454a9264-04bd-4560-a917-9a966821155b","html_url":"https://github.com/IsuruSankhajith/FCM-push-notification-http-v1","commit_stats":null,"previous_names":["isurusankhajith/fcm-push-notification-http-v1"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsuruSankhajith%2FFCM-push-notification-http-v1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsuruSankhajith%2FFCM-push-notification-http-v1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsuruSankhajith%2FFCM-push-notification-http-v1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsuruSankhajith%2FFCM-push-notification-http-v1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IsuruSankhajith","download_url":"https://codeload.github.com/IsuruSankhajith/FCM-push-notification-http-v1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240441775,"owners_count":19801790,"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","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":["fcm-push-notification","firebase","http","kotlin-android"],"created_at":"2024-11-10T03:04:20.758Z","updated_at":"2026-05-18T05:38:07.377Z","avatar_url":"https://github.com/IsuruSankhajith.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n---\n\n# FCM Push Notification HTTP v1\n\nThis project demonstrates a basic implementation of Firebase Cloud Messaging (FCM) to send and receive push notifications using HTTP in an Android application. The app is built using **Kotlin**, **Jetpack Compose**, and integrates with **Firebase** for push notifications.\n\n## Features\n\n- **Send Direct Messages**: Send notifications to a specific device using a unique FCM token.\n- **Broadcast Messages**: Broadcast a notification to all subscribed devices.\n- **Token Management**: Retrieve and manage FCM tokens for targeted messaging.\n- **Firebase Integration**: Uses Firebase Messaging Service for handling push notifications.\n- **Compose UI**: Modern Android UI using Jetpack Compose.\n  \n## Project Structure\n\n- **MainActivity**: Manages the UI and user interactions, including sending messages and requesting notification permissions.\n- **ChatViewModel**: Handles business logic, sending requests to the server, and managing state.\n- **PushNotificationService**: Handles the reception of push notifications and token generation.\n- **Retrofit API**: Communicates with the backend to send messages or broadcasts via HTTP requests.\n  \n## How to Set Up\n\n### Prerequisites\n\n- Android Studio installed\n- Firebase account with FCM enabled\n- An Android device or emulator for testing\n\n### Steps to Run\n\n1. **Clone the Repository**:\n   ```\n   git clone https://github.com/IsuruSankhajith/fcmpushnotificationhttpv1.git\n   \n   ```\n   \n2. **Set Up Firebase**:\n   - Create a new Firebase project and enable Firebase Cloud Messaging (FCM).\n   - Download the `google-services.json` file from Firebase and place it in the `app/` directory of the project.\n\n3. **Configure Backend URL**:\n   - Update the `baseUrl` in `ChatViewModel.kt` with your backend server's URL if it's different from `http://10.0.2.2:8080`.\n\n4. **Run the App**:\n   - Open the project in Android Studio and sync Gradle.\n   - Connect a device or emulator, then click the \"Run\" button.\n\n### API Endpoints\n\n- `POST /send`: Sends a message to a specific device based on its FCM token.\n- `POST /broadcast`: Broadcasts a message to all devices.\n\n### Permissions\n\nEnsure the app has the following permissions in `AndroidManifest.xml`:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.POST_NOTIFICATIONS\" /\u003e\n```\n\nFor Android 13 (Tiramisu) and above, notification permissions are requested at runtime.\n\n## Built With\n\n- **Kotlin** - Programming language\n- **Jetpack Compose** - Modern Android UI toolkit\n- **Firebase Cloud Messaging** - Push notification service\n- **Retrofit** - HTTP client for sending requests\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisurusankhajith%2Ffcm-push-notification-http-v1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisurusankhajith%2Ffcm-push-notification-http-v1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisurusankhajith%2Ffcm-push-notification-http-v1/lists"}