Application Icons

You can show the application icon as a shortcut on the home screen to allow the user to easily launch the application. In the device application list, you can show a badge with the application icon to provide additional information about the application state or notifications to the user.

The main application icon features include the following:

Figure: Badges and shortcuts

Shortcuts Badges

Prerequisites

To enable your application to use the application icon functionality, follow these steps:

  • To handle badges, follow the steps below:

    1. To use the Tizen.Applications.Badge class, the application has to request permission by adding the following privilege to the tizen-manifest.xml file:

      XML
      Copy
      <privileges> <privilege>http://tizen.org/privilege/notification</privilege> </privileges>
    2. To use the methods and properties of the Tizen.Applications.Badge class, include it in your application:

      C#
      Copy
      using Tizen.Applications.Badge;
  • To handle shortcuts, follow the steps below:

    1. To use the Tizen.Applications.Shortcut namespace, the application has to request permission by adding the following privilege to the tizen-manifest.xml file:

      XML
      Copy
      <privileges> <privilege>http://tizen.org/privilege/shortcut</privilege> </privileges>
    2. To use the methods and properties of the Tizen.Applications.Shortcut namespace, include it in your application:

      C#
      Copy
      using Tizen.Application.Shortcut;

Create and remove a badge

To create and remove badges, follow these steps:

  • To create a badge for an application, create an instance of the Tizen.Applications.Badge class. The parameter defines the application for which the badge is added. If the application is adding a badge for itself, the parameter can be null:

    C#
    Copy
    Badge badge = new Badge(appId); BadgeControl.Add(badge);

    The application that creates the badge can also update and remove it. When applications are signed with the same certificate, they can control each other’s badges.

    If an application not signed with the same certificate must be allowed to manage a badge, use the Add() method of the Tizen.Applications.BadgeControl class with a writable application ID. The writable application ID enables another application to control your application to manage the badge. You can also configure your application to handle the badge itself.

  • To remove the badge from the application, call the Remove() method. The only parameter is the ID of the application whose badge is to be removed:

    C#
    Copy
    BadgeControl.Remove(TEST_PKG);

Manage the badge

To manage the badge, follow these steps:

  • Retrieve the badge count and visibility with the Find() method of the Tizen.Applications.BadgeControl class. The values are stored in the count and visible properties of the Tizen.Applications.Badge class.

    The badge count is displayed in the upper-right corner of the badge and the count property value must be an integer. The visible property value is of the Bool type:

    C#
    Copy
    uint count; bool visible; Badge badge = BadgeControl.Find(TEST_PKG); count = badge.Count; visible = badge.Visible;
  • Set the count and visible properties with the Update() method:

    C#
    Copy
    Badge badge = new Badge(TEST_PKG); BadgeControl.Add(badge); badge.Count = 5; badge.Visible = false; BadgeControl.Update(badge);

Add a shortcut

To add a shortcut to the home screen, follow these steps:

  1. Define the shortcut details (such as its name, icon path, and whether duplicates are allowed) with the properties of the Tizen.Applications.Shortcut.HomeShortcutInfo class.

    You can create 2 types of shortcuts, they are:

    • If you set the Uri property, clicking the shortcut opens the URI.
    • If the Uri property is not set, clicking the shortcut launches the application that set the shortcut:
    C#
    Copy
    HomeShortcutInfo shortcut = new HomeShortcutInfo { ShortcutName = "Home", IconPath = "Icon_Path", IsAllowDuplicate = true, Uri = "http://www.tizen.org" };
  2. Add the shortcut using the Add() method of the Tizen.Applications.Shortcut.ShortcutManager class:

    C#
    Copy
    ShortcutManager.Add(shortcut);

Add a widget

To add a widget to the home screen, follow these steps:

  1. Before adding a widget to the home screen, a widget application must be prepared.

  2. Define the widget details (such as its ID, size, and period) with the properties of the Tizen.Applications.Shortcut.WidgetShortcutInfo class:

    C#
    Copy
    WidgetShortcutInfo shortcut = new WidgetShortcutInfo { shortcutname = "samplewidget", iconpath = "icon_path", isallowduplicate = false, widgetid = "widgetid", widgetsize = shortcutwidgetsize.widgetdefault, period = 1.0f };

    To add a widget, you must know the widget ID and supported sizes.

  3. Add the widget using the Add() method of the Tizen.Applications.Shortcut.ShortcutManager class:

    C#
    Copy
    ShortcutManager.Add(shortcut);
  • Dependencies
    • Tizen 4.0 and Higher
Application Management
Next Application Manager
Submit your feedback to GitHub