display badge number in Android using cordova - android

I am writing Android cordova application.I want to display notification count in app icon same as below image. I am using local Notification plugin for notification but how can I display badge number in app icon. I tried badge plugin of cordova. https://github.com/katzer/cordova-plugin-badge but it's not working in android.
Thanks in Advance.

This may help you to set badge
cordova.plugins.notification.badge.set(1);
also check $cordovaBadge
module.controller('MyCtrl', function($cordovaBadge) {
$cordovaBadge.set(3).then(function() {
// You have permission, badge set.
}, function(err) {
// You do not have permission.
});
});
For more see this

Stock Android does not offer this functionality at the moment on the standard launcher.
Certain manufacturers (e.g. Samsung notably) have included this functionality into their customised Android launchers. Also some 3rd-party launchers (e.g. Nova Launcher) have included an API to accomplish this.
You may want to check following links for further explaination:
How does Facebook add badge numbers on app icon in Android?
Does Samsung modifies it's Android ROMs to have badges on email and SMS icons?
How to make application badge on android?
Regards

Related

Set app icon badge number on notification while app is not runnin with expo managed

I am having some issues displaying the number of notifications on badges on Android while using expo managed workflow.
I want the badge to update when the app is killed.
On IOS is working fine by setting the badge variable a number but somehow on android i only get a little dot that is telling me that there are unread notifications but no badge is shown.
This is how it should display:
But i am getting only a dot on the icon like on this example:
My question is that by using the badge variable should while sending out push messages from the backend should this be working on android aswell and i am messing something up or do i need another approche on android?
Any suggestions are welcome since i cant find any answer on this and been searching for days now.
Many thanks,
Trix
Android notifications icon works different than on iOS because these are just one color, with transparency.
So when you reference the icon image make sure it has the transparency, if not, all the form is filled.
Also check your app.json to add this:
https://docs.expo.dev/versions/latest/sdk/notifications/#custom-notification-icon-and-colors-android-only
https://docs.expo.dev/versions/latest/config/app/#notification

How set badge number in home screen app icon android programatically?

I would like create app with custom badge number in app icon, like in facebook app: App icon in home screen shows pending/unread notifications. How to set custom badge number programatically in android. I've seen similar questions in stack with answers like it "doesn't support in stock android". Seen many answers and were old. I think they were for old versions. Is it possible in newer versions of android? If possible how to add customized badge number ? If the option is still doesn't support by android ignore this question and please let me know it. I'm developing kind of confidential app, so that i couldn't use third part libs. Is there any inbuilt methods to handle badges or possible to create badge?
There is popular github that works app icon badges for most Android devices. Sure still some platform, some devices didn't support that. But those libraries almost cover all of the devices that support app icon badges.
https://github.com/leolin310148/ShortcutBadger
So to your question, No.
Because Android framework didn't define the app notification badges before.(I am not sure if Android default framework have it now. I've been search the keyword of BADGE_COUNT_UPDATE in the ASOP android7 and nothing found) So all those custom badges are made by device manufacturer framework developer.
You can check how they setup badges numbers for each manufacturer here
https://github.com/leolin310148/ShortcutBadger/tree/master/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl
To another question. I use keyword badge to search the ASOP source code and didn't find any noticeable part about app icon badges. And even there is one inbuilt framework method about this after certain version of android. The framework still cannot cover all the devices before the certain version. So not quite sure what do you mean by confidential app, but using libraries is the first choice to cover most android devices based on the real situation like this.

Titanium PushNotification How to display in one group?

I am facing a problem with development a application.
I am using a Cloud Push Notification with Titanium Appcelerator.
I have need display push Notification in Group.
How display this is display in single particular particular tab?
I am sharing 2 images
Currently looking like this.
I have need look like this. How do?
You have to use a Big View Notification Style but it is only available in 4.1 or newer
quote from here:
A notification's big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or when the user expands the notification with a gesture. Expanded notifications are available starting with Android 4.1.
in the same document, you can find a sample how to use this. there are also som tips/hints how to maintain compatibility with older devices (not only regarded to the big view)
you must put the following code in your TiApp.xml
<property name="acs-grouped-notification-message-" type="string">You have $number$ unread messages.</property>

How to display unread count to the android app icon?

I want to display the unread count to the application icon. I refer the lots of stack overflow answers for achieving that. All the links are saying that it is not possible. But android Mail, Message application displays the unread count at the top of the icon and in some links says that use widget instead of icons. But I don't know how to use the widget instead of icon displays in android application.
Like the above image I want to display unread count in my application icon.
Unfortunately, You can't do that on application icon. Android doesn't allow that.
But you can do that using widget.
There are many question related this, check it first.
Question 1
Question 2
Question 3
Widget Example
Widget Link
Update : 24/04/2015
Now this is possible for some launcher app.
Check this ShortcutBadger and BadgeUtils
Update
Android allow Modify a Notification Badge from Android 8.0 (PI level 26).
Showing Badge in application icon is not allowed by default in Android. We can do this in some of the customized devices available in android:
Below are the links how we can show on some Device like Sony,Samsung etc.
https://github.com/leolin310148/ShortcutBadger
Utility Class I found on git:- will be helpful also
https://gist.github.com/Tadas44/cdae2f5995f21bf1c27f
And for rest of the Non customized devices we can create a custom widget to reflect this same behaviour.
See How to create Widget:
https://looksok.wordpress.com/2012/12/15/android-complete-widget-tutorial-including-source-code/

Android: Show Notifications on launcher icon

How to show notifications on launcher icon(such as native Messages,email app) in android like iphone.
Android doesnt provide a way to do this. It always references the same app launcher icon when you compile your project into an apk. There is no way to change this later on. A widget can be an alternative.

Categories

Resources