The Badging API provides a web developer with the procedure of setting badges on a document or application. It acts as a notification coming from a 3rd party app. The badge notification is displayed on the desktop corner to provide an external interface for the 3rd party app. An application with a messaging feature can display a badge on the app icon to show that new messages have arrived.
Method Of Setting Badges:
The method of setting a badge is simple, with the ‘set App Badge’ (for installed apps), or ‘set Client Badge’ (for documents). However, all these instructions should be typed with no space within the words. If no specification of an app is passed to these methods then the badge value is a flag. The user will display its notification badge, for instance, a coloured circle on the app icon.
Method Of Clearing Badges:
Badges can be cleared with the ‘clear App Badge’ and ‘clear Client Badge’ instructions. These do not assume any parameters and set the badge to the value of nothing. In addition to this, passing a value of 0 to set App Badge or set the Client Badge will also set the badge to nothing. You can also clear the badge by this method.
Concept Of Badging On Desktop
Web developers often update document favicons or titles to indicate their status. The Badging API offers a more prominent way to show status, by providing a method that is meaningful to the user agent. It can therefore be displayed in a way that matches the rest of the user interface.
Types Of Badges:
You can find two types of badges on the desktop:
- Document Badges– Document badges are mostly shown in the browser tab near or on the page icon.
- App Badges– App badges are associated with the icon of an installed app on your desktop. These may display on the app icon in the doc, shelf, or home screen depending on respective the device.
Badge Status:
The 3rd party app sends parameter values that will determine whether the batch will be dismissed or displayed. If the page number is set to zero no badge will be displayed, similarly, if there are other numbers set as badge values the badge will be displayed. There are 3 types of badge status-
Nothing –It shows that no badge is currently set. A badge can be in this state because either it has been cleared by the application, or reset by the user agent.
Flag – It indicates that the badge is set, but has no specific data to display. A badge will be in a Flag state if the user has set a badge but has not passed any value to the method.
An Integer – It indicates that a value has been passed when setting the badge. This value is more than 0, as passing a value of 0 when setting a badge will cause the user agent to clear the badge by setting it to nothing.
Conclusion
In some desktops, external interfaces can be used to display badges. For example, Huawei gives the database URI and operation permissions to a third-party app. Using the interface, the third-party app sends the number of badges to be displayed.