{"id":19738001,"url":"https://github.com/devsu/android-push-client","last_synced_at":"2025-04-30T05:30:57.724Z","repository":{"id":57718789,"uuid":"48399449","full_name":"devsu/android-push-client","owner":"devsu","description":"Library that allows you to easily receive GCM / FCM Push Messages on Android","archived":false,"fork":false,"pushed_at":"2017-11-11T21:16:34.000Z","size":154,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-08-23T06:01:09.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devsu.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-21T23:23:50.000Z","updated_at":"2018-05-23T14:36:02.000Z","dependencies_parsed_at":"2022-09-26T21:40:31.430Z","dependency_job_id":null,"html_url":"https://github.com/devsu/android-push-client","commit_stats":null,"previous_names":["devsu/gcm-push-client"],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fandroid-push-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fandroid-push-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fandroid-push-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fandroid-push-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsu","download_url":"https://codeload.github.com/devsu/android-push-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224197880,"owners_count":17271999,"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":[],"created_at":"2024-11-12T01:13:01.461Z","updated_at":"2024-11-12T01:13:02.109Z","avatar_url":"https://github.com/devsu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCM Push Client #\n\nGCM Push Client is an Android library that allows receiving Push Messages, without dealing with the hassle of making your Receiver, GCM Registration Service and all of that fun stuff.\n\n## Overview ###\n\nUsing GCM Push Client is very simple. You can import GCM Push Client on your build.gradle file (using jCenter or Maven Central):\n\n```\n    // Remember to add your GCM Play Services dependency!\n    compile 'com.google.android.gms:play-services-gcm:11.4.2'\n\n    // Or if you're using FCM, import the FCM dependency!\n    compile 'com.google.firebase:firebase-messaging:11.4.2'\n\n    compile 'com.devsu:pushclient:1.1.2'\n```\n\nAdd the com.google.gms.google-services plugin, and then, initialize the library on your Application. That's it!\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        ...\n\n        // FCM is selected by default\n        FirebaseApp.initialize(this);\n        PushClient.initialize(this, \"MY_GCM_ID\");\n\n        // Or GCM\n        PushClient.initialize(this, Provider.GCM, \"MY_GCM_ID\");\n    }\n}\n```\n\n## InitCallback ###\n\nCustomize your client's behavior when retrieving your GCM registration ID.\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        ...\n        PushClient.initialize(this, \"MY_GCM_ID\", new InitCallback() {\n            @Override\n            public void onSuccess(String registrationId, boolean hasBeenUpdated) {\n                Log.i(TAG, \"This is my registrationId: \" + registrationId);\n            }\n\n            @Override\n            public void onError(Throwable throwable) {\n                Log.e(TAG, \"An error occurred :(\");\n            }\n        });\n    }\n}\n```\n\n## Customizing ###\n\nUsing the delegation pattern, GCM Push Client is easy to customize. Simply create your own class that implements `PushDelegate`, or change the default settings on `SimpleNotificationDelegate`.\n\n### Custom Delegate ###\n\nCreate your own Delegate Class:\n\n```java\npublic class ToastDelegate implements PushDelegate {\n\n    private String mMessageKey;\n    private Context mContext;\n\n    public ToastDelegate(Context context) {\n        this.mContext = context;\n    }\n    ...\n\n    @Override\n    public void handleNotification(Context context, Bundle extras) {\n        String message = extras.getString(mMessageKey, null);\n        if (message == null) {\n            return;\n        }\n        Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();\n    }\n}\n```\n\nInitialize it!\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        ...\n        PushClient.initialize(this, Provider.GCM, \"MY_GCM_ID\", new ToastDelegate(this));\n    }\n}\n```\n\n### Customizing SimpleNotificationDelegate ###\n\nYou can change every aspect of your Push Notification!\n\n```java\npublic class MyApplication extends Application {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        ...\n        PushClient.initialize(this, Provider.FCM, \"MY_GCM_ID\");\n        SimpleNotificationDelegate delegate = (SimpleNotificationDelegate) PushClient.getDelegate();\n\n        // Change the large icon\n        delegate.setLargeIconDrawableResId(R.drawable.ic_icon_large);\n\n        // Change the small icon\n        delegate.setSmallIconDrawableResId(R.drawable.ic_icon_small);\n\n        // Change the Activity that opens on Notification click\n        delegate.setDefaultActivity(MainActivity.class);\n\n        // Change title and message keys\n        delegate.setTitleKey(\"TITLE_KEY\");\n        delegate.setMessageKey(\"MESSAGE_KEY\");\n\n        // Change the vibration pattern\n        delegate.setVibrationPattern(new long[] {0, 500, 200, 1000});\n\n        // AND MUCH MORE!\n    }\n}\n```\n\n## Authors ##\nFeel free to contact Alvaro López at rion18@hotmail.com!\n\n## License ###\n\nCopyright 2015 Devsu Software\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fandroid-push-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsu%2Fandroid-push-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fandroid-push-client/lists"}