Add icon image to notification

This code shows how to add icon image to notification using Web Device Notification API.
//Using relative file location:

var notificationDict = 
{
   content: "This is a simple notification.",
   iconPath: "opt/user/apps/{packageId}/res/wgt/assets/icon.png"
};
var notification = new tizen.StatusNotification("SIMPLE", 
       "Simple notification", notificationDict);
            
tizen.notification.post(notification);

//where {packageId} - the application package identifier, specified in configuration file (config.xml).

//Using virtual root location:

//f.e. "wgt-package" root directory
var notificationDict = 
{
   content: "This is a simple notification.",
   iconPath: "wgt-package/assets/icon.png"
};

//or "images" root directory
var notificationDict = 
{
   content: "This is a simple notification.",
   iconPath: "images/icon.png"
};
var notification = new tizen.StatusNotification("SIMPLE", 
       "Simple notification", notificationDict);
            
tizen.notification.post(notification);

Responses

0 Replies