{"id":16681756,"url":"https://github.com/casidiablo/c2dm-library","last_synced_at":"2025-05-14T15:30:33.690Z","repository":{"id":2824912,"uuid":"3827088","full_name":"casidiablo/c2dm-library","owner":"casidiablo","description":"Cloud To Device Messaging Library","archived":false,"fork":false,"pushed_at":"2012-03-26T00:19:09.000Z","size":112,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T06:25:12.372Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casidiablo.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}},"created_at":"2012-03-25T20:32:04.000Z","updated_at":"2014-06-03T02:22:04.000Z","dependencies_parsed_at":"2022-07-13T00:31:12.473Z","dependency_job_id":null,"html_url":"https://github.com/casidiablo/c2dm-library","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fc2dm-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fc2dm-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fc2dm-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casidiablo%2Fc2dm-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casidiablo","download_url":"https://codeload.github.com/casidiablo/c2dm-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254171518,"owners_count":22026456,"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-10-12T14:05:12.925Z","updated_at":"2025-05-14T15:30:31.169Z","avatar_url":"https://github.com/casidiablo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cloud to Device Messaging Library\n=================================\n\nThis is just a mavenized, improved version of the [C2DM][1] classes used by some demo apps. It is meant to make\nit easier for any Android developer to implement [C2DM][1] in his/her app. Before you use this library, make sure\nyou already have [signup to C2DM][2].\n\n###Usage\n\n1\\. Just add this to your POM:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.codeslap\u003c/groupId\u003e\n    \u003cartifactId\u003ec2dm-library\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nor [download the JAR][3] from the Maven Central Repository and link it manually to your project.\n\n2\\. Create a class that extends [`com.google.android.c2dm.C2DMBaseReceiver`][4] (remember that, since this class is\nactually an Android [`Service`][5], you must declare a default constructor; and you must send the registered sender email to the super class. For\ninstance: `super(\"your_registerd_sender_id@gmail.com\")`). Then modify your manifest to look like this:\n\n```xml\n\u003capplication... \u003e\n\n    \u003c!-- C2DM service and receiver --\u003e\n    \u003cservice android:name=\"com.your.package.name.YourReceiverImplementation\"/\u003e\n    \u003creceiver android:name=\"com.google.android.c2dm.C2DMBroadcastReceiver\"\n              android:permission=\"com.google.android.c2dm.permission.SEND\"\u003e\n        \u003cmeta-data android:name=\"com.google.android.c2dm.implementation\"\n                   android:value=\"com.your.package.name.YourReceiverImplementation\"/\u003e\n        \u003cintent-filter\u003e\n            \u003caction android:name=\"com.google.android.c2dm.intent.RECEIVE\"/\u003e\n            \u003ccategory android:name=\"com.your.package.name\"/\u003e\n        \u003c/intent-filter\u003e\n        \u003cintent-filter\u003e\n            \u003caction android:name=\"com.google.android.c2dm.intent.REGISTRATION\"/\u003e\n            \u003ccategory android:name=\"com.your.package.name\"/\u003e\n        \u003c/intent-filter\u003e\n    \u003c/receiver\u003e\n\n\u003c/application\u003e\n\n\u003cpermission android:name=\"com.your.package.name.C2D_MESSAGE\" android:protectionLevel=\"signature\"/\u003e\n\u003cuses-permission android:name=\"android.permission.INTERNET\"/\u003e\n\u003cuses-permission android:name=\"android.permission.WAKE_LOCK\"/\u003e\n\u003cuses-permission android:name=\"com.google.android.c2dm.permission.RECEIVE\"/\u003e\n\u003cuses-permission android:name=\"com.your.package.name.permission.C2D_MESSAGE\"/\u003e\n```\n\n3\\. When necessary, register the device using `C2DMessaging.register(String)` method. For instance:\n\n```java\n// this can be placed in your home activity.\nString registrationId = C2DMessaging.getRegistrationId(this /**context**/);\nif (TextUtils.isEmpty(registrationId)) {\n    C2DMessaging.register(this, \"your_registerd_sender_id@gmail.com\");\n}\n```\n\nDo not forget to send the registration ID to your server from the `onRegistration` method of your\n[`com.google.android.c2dm.C2DMBaseReceiver`][4] implementation. You need that ID to send push notifications to\nthe clients.\n\n  [1]: http://code.google.com/android/c2dm/index.html\n  [2]: http://code.google.com/android/c2dm/signup.html\n  [3]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.codeslap%22%20a%3A%22c2dm-library%22\n  [4]: https://github.com/casidiablo/c2dm-library/blob/master/src/main/java/com/google/android/c2dm/C2DMBaseReceiver.java\n  [5]: http://developer.android.com/reference/android/app/Service.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasidiablo%2Fc2dm-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasidiablo%2Fc2dm-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasidiablo%2Fc2dm-library/lists"}