We have a scenario where the number of push notifications may be out of sync with those in-app, therefore we want to display an image such as a bell icon instead of a numerical notification.
This can be achieved either by changing the push notification from a number to an image OR by having 2 app icon images, the regular one plus one with an image notification overlaid, and we can switch between the 2 phone app images depending on whether there are any unread notifications or not.
Does anyone know if either are possible at all?
We're using OneSignal for the push notifications.
E.g. 92 would be a picture of a bell.
Hello Sienna,
I'm not sure about this particular case but I have implemented displaying 2 different icons based on If condition.
Thanks,
Sanjay
Hi Sanjay,
I know it's possible in both Android and iOS (from 10.3 onwards I think it is), and is fairly simple to do, but not sure how to do it in OS.
I was thinking about seeing if there is anything already in github that maybe I could use but if there's something already inbuilt that would be helpful.
How did you implement the different images?
Sienna
Hi Sienna,
I was talking about OS only. There is an IF widget in OS which can be used to display 2 different images based on condition. See below snaps for example :
Here I used 2 icons(each for true and false part), but you can place Image widget and give your own images also :-
Condition can be written like this :
Hope it helps!
Looks like you're talking about something different entirely.
I want to be able to change the icon for an app that is displayed on a phone, for example on the phone's homepage, like the Whatsapp icon in the image above.
It seems you are talking about changing images inside the app.
Yeah got it, My bad, Sorry for misunderstanding.
Sanjay Kumar Sahu wrote:
No worries, appreciate you trying to help anyway.
Hi,
iOS:https://developer.apple.com/documentation/uikit/uiapplication section "Managing the App's Icon" says there are four different ways to manipulate app icon:
var applicationIconBadgeNumber: Int
var supportsAlternateIcons: Bool
var alternateIconName: String?
func setAlternateIconName(String?, completionHandler: ((Error?) -> Void)?)
It seems there is no option to change numbers to icons in badges, and I don't recall ever seeing such a thing on iOS.
Android:https://developer.android.com/training/notify-user/badges shows the same things are possible with Android app badges, aka. using a small icon (red dot), large icon (numbers) or none. No mentions of using icons inside badges.
From these pieces of information, and from the lack of any evidence to support this functionality in OneSignal documentation, I'd say it's (currently) not possible to replace iOS or Android app icon badge number with an icon.
edit: Further dive in to the rabbit hole. Android allows you to set the icon from resources, so yes - this is indeed possible. See https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)
If there's very insisting customer involved, a hacky way would be to change the whole app icon whenever there's something changed in the app (and to disable the notification badges).
Mikko Nieminen - that's exactly what I'm wanting to do.
My aim is to forego numerical badges altogether and instead rely on 2 images - one being the standard app icon, the other the app icon with a bell badge on it.
Then you display either the regular icon when there are no notifications, or the icon with the bell badge whenever there are notifications.
It seems I need to have an Apache Cordova plugin in order to do it as there's nothing in OS and no existing components with that functionality.
Sienna wrote:
Now there's a good opportunity to go create your own plugin! Maybe share the results with us, too? :D
From OS, App icons can be defined/customized through extensibility configuration, this is build-time thing: https://success.outsystems.com/Documentation/11/Delivering_Mobile_Apps/Customize_Your_Mobile_App/Modify_the_App_Icon
To change icon after installation (=runtime), you are right - plugin is needed. For iOS there's already an existing Cordova plugin (https://github.com/EddyVerbruggen/cordova-plugin-app-icon-changer) which you can leverage, but for Android, I'm not sure if this can be done. That being said, there are some ideas floating around using activity aliases:
Bottom line is - you need to define Android launcher icon in AndroidManifest.xml, which cannot be changed after .apk is signed.
Thanks for the info Mikko - and if I get the chance to do it I will definitely share it.I've not created one like this before though so bit of a learning curve, I do have a component on the forge but that was written in C# so integrated using Integration Studio, which is very different.