{"id":16223761,"url":"https://github.com/lykmapipo/android-push","last_synced_at":"2025-03-19T12:30:33.949Z","repository":{"id":139148294,"uuid":"129508952","full_name":"lykmapipo/android-push","owner":"lykmapipo","description":"Android FCM library","archived":false,"fork":false,"pushed_at":"2022-12-08T01:20:04.000Z","size":270,"stargazers_count":8,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T07:05:41.532Z","etag":null,"topics":["android","fcm","firebase","gcm","lykmapipo","notification","push"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lykmapipo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-04-14T11:00:59.000Z","updated_at":"2024-12-30T01:09:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"7eedb383-d12e-4f96-a1bc-a75a18bd5d51","html_url":"https://github.com/lykmapipo/android-push","commit_stats":{"total_commits":110,"total_committers":1,"mean_commits":110.0,"dds":0.0,"last_synced_commit":"d398835208a0c73915fc42d413391831dedc0a5d"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-push","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-push/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-push/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-push/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykmapipo","download_url":"https://codeload.github.com/lykmapipo/android-push/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244426363,"owners_count":20450950,"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":["android","fcm","firebase","gcm","lykmapipo","notification","push"],"created_at":"2024-10-10T12:20:00.498Z","updated_at":"2025-03-19T12:30:33.667Z","avatar_url":"https://github.com/lykmapipo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"android-push\n=======================\n\n[![](https://jitpack.io/v/lykmapipo/android-push.svg)](https://jitpack.io/#lykmapipo/android-push)\n\nAndroid FCM library\n\n\n## Installation\nAdd [https://jitpack.io](https://jitpack.io) to your build.gradle with:\n```gradle\nallprojects {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nadd `android-push` dependency into your project\n\n```gradle\ndependencies {\n    implementation 'com.github.lykmapipo:android-push:v0.14.0'\n}\n```\n\n## Usage\n\nInitialize `android-push`\n\n```java\npublic class SampleApp extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n\n        Push.of(apiBaseUrl, new Provider() {\n            @NonNull\n            @Override\n            public Context getApplicationContext() {\n                return SampleApp.this.getApplicationContext();\n            }\n        }, new AuthProvider() {\n            @Override\n            public String getToken() {\n                return apiKey;\n            }\n        });\n    }\n}\n```\n\nIn activity start listen for the foreground push message\n\n```java\npublic class MainActivity extends PushCompactActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n    }\n\n    @Override\n    public void onMessage(RemoteMessage remoteMessage) {\n        ...\n    }\n\n     @Override\n     public void onRegistrationTokenRefreshed(Device device) {\n        ....\n     }\n\n     @Override\n     public void onRegistrationTokenError(String error) {\n        ...\n     }\n     \n     @Override\n      public void onDeviceSynced(Device device) {\n        ...\n      }\n      \n      @Override\n      public void onDeviceSyncError(String error) {\n        ...\n      }\n}\n```\n\n## Android API\n\n### Force Device Sync with Extra Details\nTo force sync application specific extra details you may call `push.sync(\u003cextraKey\u003e, \u003cextraValue\u003e)` or `push.sync(mapOfExtras)`\n which will force syncing the device details to your backend api.\n\nAll extras will be send under `extras` field of the device details sent to the server.\n\nExample\n```js\n{ \n  extras: { \n      phone: '255714999999' \n   },\n  instanceId: \u003cfirebaseInstanceId\u003e,\n  registrationToken: \u003cfirebasePushRegistrationToken\u003e,\n  topics: [], //list of topic device subscribe to\n  uuid: \u003cuniquePseudoId\u003e \n}\n```\n\n## API Server Implementation\n\nAPI Server endpoint must implemnt `device REST aware resource` and support both `POST` and `PUT` request.\n\n- [See Sample](https://github.com/lykmapipo/android-push/blob/master/api/index.js)\n\nAuthorization header is set with the value `Bearer \u003capiAuthorizationToken\u003e` on every request sent.\n\nThe structure of the information synced to the API end-point is as below:\n```js\n{\n    instanceId: String, //FCM instance id\n    registrationToken: String, //FCM devic registration token\n    topics: [String], //FCM device topic\n    uuid: String, // Generated device pseudocode\n    info:{ //device information\n       tags: String,\n       model: String,\n       hardware: String,\n       display: String,\n       board: String,\n       type: String,\n       product: String,\n       fingerprint: String,\n       manufacturer: String,\n       device: String,\n       brand: String,\n       sdk: String,\n       serial: String \n    },\n    extras:{ //application specific extra details about the installation\n   \n    }\n}\n```\n\n\n## Test\n```sh\n./gradlew test\n```\n\n## Contribute\nIt will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas.\nDo not forget to add a bit of test(s) of what value you adding.\n\n## License\n\n(The MIT License)\n\nCopyright (c) lykmapipo \u0026\u0026 Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fandroid-push","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykmapipo%2Fandroid-push","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fandroid-push/lists"}