语言

Menu
Sites
Language
Creating notifications from a service, Tizen wearable 2.3.2

I am trying to create a service that can post notification to users.

void set_notification(void)
{
    notification_h notification = NULL;
    notification = notification_create(NOTIFICATION_TYPE_NOTI);
    if(notification != NULL)
    {
        dlog_print(DLOG_INFO, "FALL_DETECTION", "Hello World from a notification!");
        notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "Alarm", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
        notification_set_time_to_text(notification, time(NULL), NOTIFICATION_TEXT_TYPE_CONTENT);
        notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "Failure of Valve 4", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
        //notification_set_display_applist(notification, NOTIFICATION_DISPLAY_APP_ALL);
        notification_set_size(notification, 0.5);
        notification_set_layout(notification, NOTIFICATION_LY_ONGOING_EVENT );
        notification_set_vibration(notification, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
        int ret = notification_post(notification);
        if (ret == NOTIFICATION_ERROR_NONE)
            dlog_print(DLOG_INFO, "FALL_DETECTION", "Notification created!");
        else if(ret == NOTIFICATION_ERROR_INVALID_PARAMETER)
            dlog_print(DLOG_INFO, "FALL_DETECTION", "Notification has invalid parameter!");
        else
            dlog_print(DLOG_INFO, "FALL_DETECTION", "Permission for notification denied!");
    }
}

The notification_post returns NOTIFICATION_ERROR_NONE but the notification doesn't appear. Any advice ?

Thanks!

响应

1 回复
K Johnson

Because it's supported in Tizen 3.0 and Higher for Wearable. Please have a look in this link.