{"id":18426132,"url":"https://github.com/clevertap/apns-http2","last_synced_at":"2025-04-14T08:16:46.394Z","repository":{"id":5024809,"uuid":"49942319","full_name":"CleverTap/apns-http2","owner":"CleverTap","description":"A Java library for sending notifications via APNS using Apple's HTTP/2 API. ","archived":false,"fork":false,"pushed_at":"2024-12-02T06:12:33.000Z","size":228,"stargazers_count":219,"open_issues_count":31,"forks_count":109,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-14T08:16:42.127Z","etag":null,"topics":["apns","apns-http2","apple","http2","java-library","notifications","okhttp","sending-notifications"],"latest_commit_sha":null,"homepage":"https://clevertap.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleverTap.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":"2016-01-19T09:41:35.000Z","updated_at":"2025-02-13T17:17:52.000Z","dependencies_parsed_at":"2024-11-13T06:00:47.312Z","dependency_job_id":"bbc52570-5496-49da-9c2f-fb7a76060ee7","html_url":"https://github.com/CleverTap/apns-http2","commit_stats":{"total_commits":132,"total_committers":13,"mean_commits":"10.153846153846153","dds":"0.43939393939393945","last_synced_commit":"3fc3ccbf8fe57a0dbf8dee2a87f4d1775852105d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fapns-http2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fapns-http2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fapns-http2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fapns-http2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleverTap","download_url":"https://codeload.github.com/CleverTap/apns-http2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248844000,"owners_count":21170499,"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":["apns","apns-http2","apple","http2","java-library","notifications","okhttp","sending-notifications"],"created_at":"2024-11-06T05:06:59.714Z","updated_at":"2025-04-14T08:16:46.347Z","avatar_url":"https://github.com/CleverTap.png","language":"Java","readme":"# apns-http2\n\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=CleverTap_apns-http2\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=CleverTap_apns-http2) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=CleverTap_apns-http2\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=CleverTap_apns-http2)\n\nA Java library for sending notifications via APNS using Apple's new HTTP/2 API.\nThis library uses OkHttp.\nPrevious versions included support for Jetty's client,\nhowever, we've removed that due to instability of the Jetty client.\n\n**Note:** Ensure that you have Jetty's ALPN JAR (OkHttp requires it) in your boot classpath. [See here for more information](http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html).\nThis is required until Java 9 is released, as Java 8 does not have native support for HTTP/2.\n\n## Installation\n- Clone this repository, and add it as a dependent maven project\n- Maven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.clevertap.apns\u003c/groupId\u003e\n  \u003cartifactId\u003eapns-http2\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.3\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n- Maven build steps\n```\nmvn package\n```\nThe above command will create jars in ***target/*** directory. One out of those jar will be ***apns-http2-1.0.3-jar-with-dependencies.jar*** and ***apns-http2-1.0.3.jar***.\n\n\n- Gradle  \n```\ncompile 'com.clevertap.apns:apns-http2:1.0.3'\n```\n\n## Usage\n\n### Create a client\n\n#### Using provider certificates\n\n```\nFileInputStream cert = new FileInputStream(\"/path/to/certificate.p12\");\nfinal ApnsClient client = new ApnsClientBuilder()\n        .withProductionGateway()\n        .inSynchronousMode()\n        .withCertificate(cert)\n        .withPassword(\"\")\n        .withDefaultTopic(\"\u003cyour app's topic\u003e\")\n        .build();\n```\n\n#### Using provider authentication tokens\n```\nfinal ApnsClient client = new ApnsClientBuilder()\n        .inSynchronousMode()\n        .withProductionGateway()\n        .withApnsAuthKey(\"\u003cyour APNS auth key, excluding -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY-----\u003e\")\n        .withTeamID(\"\u003cyour team ID here\u003e\")\n        .withKeyID(\"\u003cyour key ID here, present in the auth key file name\u003e\")\n        .withDefaultTopic(\"\u003cyour app's topic\u003e\")\n        .build();\n```\n\n### Build your notification\nThe notification builder supports several other features (such as badge, category, etc).\nThe minimal is shown below:\n\n```\nNotification n = new Notification.Builder(\"\u003cthe device token\u003e\")\n        .alertBody(\"Hello\").build();\n\n```\n\n### Send the notification\n\n#### Asynchronous\n \n```\nclient.push(n, new NotificationResponseListener() {\n    @Override\n    public void onSuccess(Notification notification) {\n        System.out.println(\"success!\");\n    }\n    @Override\n    public void onFailure(Notification notification, NotificationResponse nr) {\n        System.out.println(\"failure: \" + nr);\n    }\n});\n```\n\n#### Synchronous\n\n```\nNotificationResponse result = client.push(n);\nSystem.out.println(result);\n```\n\n## License\nLicensed under the [New 3-Clause BSD License](http://opensource.org/licenses/BSD-3-Clause).\n\n```\nCopyright (c) 2016, CleverTap\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of CleverTap nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevertap%2Fapns-http2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclevertap%2Fapns-http2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevertap%2Fapns-http2/lists"}