{"id":13428447,"url":"https://github.com/katzer/cordova-plugin-badge","last_synced_at":"2025-04-09T11:06:42.872Z","repository":{"id":42188220,"uuid":"12018222","full_name":"katzer/cordova-plugin-badge","owner":"katzer","description":"Access and modify badge numbers","archived":false,"fork":false,"pushed_at":"2023-04-22T18:33:52.000Z","size":57599,"stargazers_count":407,"open_issues_count":28,"forks_count":256,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-04-14T04:28:23.100Z","etag":null,"topics":["badge","badge-number","cordova-android-plugin","cordova-ios-plugin","cordova-plugin","cordova-plugin-badge"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katzer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2013-08-10T08:52:45.000Z","updated_at":"2024-03-19T15:22:53.000Z","dependencies_parsed_at":"2024-04-13T16:00:25.381Z","dependency_job_id":null,"html_url":"https://github.com/katzer/cordova-plugin-badge","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-badge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-badge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-badge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-badge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katzer","download_url":"https://codeload.github.com/katzer/cordova-plugin-badge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027407,"owners_count":21035594,"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":["badge","badge-number","cordova-android-plugin","cordova-ios-plugin","cordova-plugin","cordova-plugin-badge"],"created_at":"2024-07-31T01:00:57.522Z","updated_at":"2025-04-09T11:06:42.851Z","avatar_url":"https://github.com/katzer.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=L3HKQCD9UA35A"],"categories":["Plugins"],"sub_categories":[],"readme":"\n\u003cp align=\"left\"\u003e\u003cb\u003e\u003ca href=\"https://github.com/katzer/cordova-plugin-badge/tree/example\"\u003eSAMPLE APP\u003c/a\u003e :point_right:\u003c/b\u003e\u003c/p\u003e\n\n# Cordova Badge Plugin \u003cbr\u003e [![npm version](https://badge.fury.io/js/cordova-plugin-badge.svg)](https://badge.fury.io/js/cordova-plugin-badge) [![Code Climate](https://codeclimate.com/github/katzer/cordova-plugin-badge/badges/gpa.svg)](https://codeclimate.com/github/katzer/cordova-plugin-badge) [![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=L3HKQCD9UA35A \"Donate once-off to this project using Paypal\")\n\n[Cordova][cordova] plugin to access and modify the badge number of the app icon on various mobile platforms including iOS, Android and Windows.\n\n\u003cimg height=\"150px\" align=\"right\" hspace=\"19\" vspace=\"12\" src=\"http://4.bp.blogspot.com/-GBwBSN92DvU/UB8Kut7Oz0I/AAAAAAAAJKs/mJgBmj1RKqU/s1600/whatsapp+wp8+10.png\"\u003e\u003c/img\u003e\n\n### How they appear to the user\n\nUsers see notifications in the following ways:\n\n- Badging the app’s icon\n- Progress indicator (OSX based on https://github.com/hokein/DockProgressBar)\n\n\n### Supported Platforms\n\n- __Android / Amazon FireOS__ (via [ShortcutBadger][shortcut_badger])\n- __Browser__ (via [favico.js][favico_js])\n- __iOS 10+__\n- __OSX__\n- __Windows__ (Phone and Desktop)\n\n\n## Installation\n\nThe plugin can be installed via [Cordova-CLI][CLI] and is publicly available on [NPM][npm].\n\nExecute from the projects root folder:\n\n    $ cordova plugin add cordova-plugin-badge\n\nOr install a specific version:\n\n    $ cordova plugin add cordova-plugin-badge@VERSION\n\nOr install the latest head version:\n\n    $ cordova plugin add https://github.com/katzer/cordova-plugin-badge.git\n\nOr install from local source:\n\n    $ cordova plugin add \u003cpath\u003e --nofetch --nosave\n\n\n## Usage\n\nThe plugin creates the object `cordova.plugins.notification.badge` and is accessible after *deviceready* has been fired.\n\n```js\ndocument.addEventListener('deviceready', function () {\n    // cordova.plugins.notification.badge is now available\n}, false);\n```\n\n### Set the badge number\n\nBadge numbers cannot be negative. The maximum might be restricted by the OS.\nA callback is optional and will be invoked with the current badge number.\n\n```js\ncordova.plugins.notification.badge.set(10);\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg height=\"150px\" src=\"images/ios.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003cimg height=\"150px\" src=\"images/android.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003cimg height=\"150px\" src=\"images/windows.png\"\u003e\n\u003c/p\u003e\n\nThere's built-in support to increase the badge number:\n\n```js\ncordova.plugins.notification.badge.increase(1, function (badge) {\n    // badge is now 11 (10 + 1)\n});\n```\n\nTo decrease the badge number:\n\n```js\ncordova.plugins.notification.badge.decrease(2, function (badge) {\n    // badge is now 9 (11 - 2)\n});\n```\n\nAnd to clear out the badge number:\n\n```js\ncordova.plugins.notification.badge.clear();\n```\n\n### Get the badge number\n\nThe default value is 0. The badge number wont get lost after reboot or app restart.\n\n```js\ncordova.plugins.notification.badge.get(function (badge) {\n    ...\n});\n```\n\n__Note:__ Modifying the badge number outside of the plugin does result into wrong behaivor!\n\n### Configurations\n\nTo clear the badge number automatically if the user taps the app icon:\n\n```js\ncordova.plugins.notification.badge.configure({ autoClear: true });\n```\n\nOSX supports additional indicators. Other than to `badge` these are `circular` and `download`.\n\n```js\ncordova.plugins.notification.badge.configure({ indicator: 'circular' });\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"images/osx-badge.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003cimg src=\"images/osx-circular.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003cimg src=\"images/osx-download.png\"\u003e\n\u003c/p\u003e\n\n\n## Permissions\n\nThe plugin might ask for granting permissions to modify the badge number.\nThat's done automatically but it's also possible to request them manually:\n\n```javascript\ncordova.plugins.notification.badge.requestPermission(function (granted) {\n    ...\n});\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg height=\"200px\" src=\"images/ios-permission.png\"\u003e\n\u003c/p\u003e\n\nTo check if they have been granted already:\n\n```javascript\ncordova.plugins.notification.badge.hasPermission(function (granted) {\n    ...\n});\n```\n\n\n## Quirks\n\nOn Android not all launchers support badges. In order to set badges the plugin uses [ShortcutBadger][shortcut_badger]. Check out their website to see which launchers are supported.\n\nIf you're using PhoneGap Build please make sure you specify gradle as your Android build tool in config.xml:\n\n```xml\n\u003cpreference name=\"android-build-tool\" value=\"gradle\" /\u003e\n```\n\nTo specify a custom version of _ShortcutBadger_ follow this [guide][gradle-guide]. The name of the property is `appShortcutBadgerVersion`.\n\n```gradle\n# In \u003cyour-project\u003e/platforms/android/gradle.properties\nappShortcutBadgerVersion=1.1.22\n```\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nThis software is released under the [Apache 2.0 License][apache2_license].\n\nMade with :yum: from Leipzig\n\n© 2013 [appPlant GmbH][appplant]\n\n\n[cordova]: https://cordova.apache.org\n[shortcut_badger]: https://github.com/leolin310148/ShortcutBadger\n[favico_js]: http://lab.ejci.net/favico.js/\n[CLI]: http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface\n[npm]: https://www.npmjs.com/package/cordova-plugin-badge\n[gradle-guide]: https://cordova.apache.org/docs/en/latest/guide/platforms/android/#configuring-gradle\n[apache2_license]: http://opensource.org/licenses/Apache-2.0\n[appplant]: http://appplant.de\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fcordova-plugin-badge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatzer%2Fcordova-plugin-badge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fcordova-plugin-badge/lists"}