All Projects → katzer → Cordova Plugin Badge

katzer / Cordova Plugin Badge

Licence: apache-2.0
Access and modify badge numbers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Cordova Plugin Badge

badgemaker
The Nim badgemaker tool.
Stars: ✭ 15 (-96.11%)
Mutual labels:  badge
Cordova qq
A Cordova wrapper around the Tencent QQ SDK for Android and iOS. Provides access to QQ ssoLogin, QQ Sharing, QQZone Sharing etc.
Stars: ✭ 294 (-23.83%)
Mutual labels:  cordova-plugin
Handycontrols
Contains some simple and commonly used WPF controls based on HandyControl
Stars: ✭ 347 (-10.1%)
Mutual labels:  badge
made-with-love-in
🛠️ ❤️ 🗺️ 🛡️ — Mircoservice for serving and listing "Made with love in <country-name>" badges
Stars: ✭ 21 (-94.56%)
Mutual labels:  badge
Cordova Plugin Nativestorage
Cordova plugin: Native storage of variables in Android, iOS and Windows
Stars: ✭ 285 (-26.17%)
Mutual labels:  cordova-plugin
Kratos Boilerplate
🔥 A simple boilerplate for creating statics PWA using Webpack, Pug, PostCSS and CSS Modules
Stars: ✭ 308 (-20.21%)
Mutual labels:  badge
Yeebadge
badgeView for UIView Inspired by WZLBadge,using UIImage to avoid off-screen rendering
Stars: ✭ 33 (-91.45%)
Mutual labels:  badge
Cordova Plugin App Version
Cordova plugin to return the version number of the current app
Stars: ✭ 374 (-3.11%)
Mutual labels:  cordova-plugin
Cordova Plugin App Update
App updater for Cordova/PhoneGap
Stars: ✭ 290 (-24.87%)
Mutual labels:  cordova-plugin
Cordova Plugin Email Composer
Edit and send email messages
Stars: ✭ 333 (-13.73%)
Mutual labels:  cordova-plugin
Cordova Plugin Geofence
Geofencing plugin for cordova
Stars: ✭ 261 (-32.38%)
Mutual labels:  cordova-plugin
Badge Size
🍻 Displays the size of a given file in your repository.
Stars: ✭ 277 (-28.24%)
Mutual labels:  badge
Gorganizer
Organize your folders into a beautiful classified folder structure with this perfect tool
Stars: ✭ 318 (-17.62%)
Mutual labels:  badge
ETBadge
A tool of swift to add or clear badge for any UIView。You can use it easily, also can custom it.
Stars: ✭ 19 (-95.08%)
Mutual labels:  badge
Slwidget
轮子合集。角标、滚动选择器、自动换行布局、侧滑返回。
Stars: ✭ 363 (-5.96%)
Mutual labels:  badge
ionic-signature-pad
Ionic plugin to input singnature pad
Stars: ✭ 15 (-96.11%)
Mutual labels:  cordova-plugin
Xamarin Forms Tab Badge
Xamarin Forms bindable Tab badges for iOS, Android, UWP, MacOS and WPF
Stars: ✭ 304 (-21.24%)
Mutual labels:  badge
Swift Badge
A badge view for iOS/tvOS written in Swift
Stars: ✭ 379 (-1.81%)
Mutual labels:  badge
Open Source Badges
Open Source & Licence Badges
Stars: ✭ 368 (-4.66%)
Mutual labels:  badge
Vue Cordova
Vue.js plugin for Cordova
Stars: ✭ 328 (-15.03%)
Mutual labels:  cordova-plugin

SAMPLE APP 👉

Cordova Badge Plugin
npm version Code Climate PayPayl donate button

Cordova plugin to access and modify the badge number of the app icon on various mobile platforms including iOS, Android and Windows.

How they appear to the user

Users see notifications in the following ways:

Supported Platforms

Installation

The plugin can be installed via Cordova-CLI and is publicly available on NPM.

Execute from the projects root folder:

$ cordova plugin add cordova-plugin-badge

Or install a specific version:

$ cordova plugin add [email protected]

Or install the latest head version:

$ cordova plugin add https://github.com/katzer/cordova-plugin-badge.git

Or install from local source:

$ cordova plugin add <path> --nofetch --nosave

Usage

The plugin creates the object cordova.plugins.notification.badge and is accessible after deviceready has been fired.

document.addEventListener('deviceready', function () {
    // cordova.plugins.notification.badge is now available
}, false);

Set the badge number

Badge numbers cannot be negative. The maximum might be restricted by the OS. A callback is optional and will be invoked with the current badge number.

cordova.plugins.notification.badge.set(10);

         

There's built-in support to increase the badge number:

cordova.plugins.notification.badge.increase(1, function (badge) {
    // badge is now 11 (10 + 1)
});

To decrease the badge number:

cordova.plugins.notification.badge.decrease(2, function (badge) {
    // badge is now 9 (11 - 2)
});

And to clear out the badge number:

cordova.plugins.notification.badge.clear();

Get the badge number

The default value is 0. The badge number wont get lost after reboot or app restart.

cordova.plugins.notification.badge.get(function (badge) {
    ...
});

Note: Modifying the badge number outside of the plugin does result into wrong behaivor!

Configurations

To clear the badge number automatically if the user taps the app icon:

cordova.plugins.notification.badge.configure({ autoClear: true });

OSX supports additional indicators. Other than to badge these are circular and download.

cordova.plugins.notification.badge.configure({ indicator: 'circular' });

         

Permissions

The plugin might ask for granting permissions to modify the badge number. That's done automatically but it's also possible to request them manually:

cordova.plugins.notification.badge.requestPermission(function (granted) {
    ...
});

To check if they have been granted already:

cordova.plugins.notification.badge.hasPermission(function (granted) {
    ...
});

Quirks

On Android not all launchers support badges. In order to set badges the plugin uses ShortcutBadger. Check out their website to see which launchers are supported.

If you're using PhoneGap Build please make sure you specify gradle as your Android build tool in config.xml:

<preference name="android-build-tool" value="gradle" />

To specify a custom version of ShortcutBadger follow this guide. The name of the property is appShortcutBadgerVersion.

# In <your-project>/platforms/android/gradle.properties
appShortcutBadgerVersion=1.1.22

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This software is released under the Apache 2.0 License.

Made with 😋 from Leipzig

© 2013 appPlant GmbH

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].