An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers.
From StackOverflow a android user WeWe asked a question :
Then i search and find a helpful android library named ShortcutBadger. The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!
Support launchers:
1. Add mavenCentral to your build script.
repositories {
dependencies {
3. Add the codes below:
4. If you want to remove the badge
ShortcutBadger.removeCount(context); //for 1.1.4
ShortcutBadger.applyCount(context, 0); //for 1.1.4
REASON FOR WARNING: Violation of section 4.4 of the Developer Distribution Agreement.
Please use version 1.1.0+
From StackOverflow a android user WeWe asked a question :
Q. How to display balloon counter over application launcher icon on android
Then i search and find a helpful android library named ShortcutBadger. The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!
Support launchers:
Download Library
USAGE
1. Add mavenCentral to your build script.
repositories {
mavenCentral() }2. Add dependencies for ShortcutBadger, it's available from maven now.
dependencies {
compile 'me.leolin:ShortcutBadger:1.1.4@aar' }
3. Add the codes below:
int badgeCount = 1; ShortcutBadger.applyCount(context, badgeCount); //for 1.1.4 ShortcutBadger.with(getApplicationContext()).count(badgeCount); //for 1.1.3
4. If you want to remove the badge
ShortcutBadger.removeCount(context); //for 1.1.4
ShortcutBadger.with(getApplicationContext()).remove(); //for 1.1.3or
ShortcutBadger.applyCount(context, 0); //for 1.1.4
ShortcutBadger.with(getApplicationContext()).count(0); //for 1.1.3
Note :
If you receive mail from Google contains message like :REASON FOR WARNING: Violation of section 4.4 of the Developer Distribution Agreement.
Please use version 1.1.0+
Hello ,
ReplyDeleteGreat lib, but one thing : your library does not support for pure android. for that what i do ?
You have only copy pasted the library, why don't you elaborate the things related to library.
ReplyDeleteWhere to put the library in cordova app if i'm using the eclipse.
Where to write the code :
int badgeCount = 1;
ShortcutBadger.applyCount(context, badgeCount); //for 1.1.4
ShortcutBadger.with(getApplicationContext()).count(badgeCount); //for 1.1.3
I got your problem and my next post you can get your solution but yet you can make badge in android manually.
DeleteJust check this post :Make Badge(Item count) in Android [Tutorial]
I got your problem and my next post you can get your solution but yet you can make badge in android manually.
ReplyDeleteJust check this post :Make Badge(Item count) in Android [Tutorial]