0

我是 Tizen 的新手,我尝试开发一个可穿戴的原生应用程序(2.3.2),可以通过单击按钮来创建通知。到目前为止它有效,但我想知道是否可以自定义通知。

我的问题:

  1. 我想在通知上插入一个用于用户交互的按钮。这可能吗?有没有其他方法可以在通知上创建一个按钮,或者这在 Tizen 2.3.2 中对于可穿戴设备是不可能的?
  2. 有没有办法自定义每次创建新通知时(自动?)显示的弹出窗口(例如添加应用程序图标,显示通知内容的一部分......)?
  3. 我完全不确定那里显示的时间 - 在模拟器上进行测试时,这对我来说似乎是完全随机的。是否可以删除通知托盘中通知标题下显示的时间戳?通知上的时间戳应该可以通过 修改notification_set_time(notification, time(NULL));,但它对我不起作用。只是显示了完全随机的值(不是实际的系统时间;与notification_set_time_to_text代码行 9 相同)。显示的通知中没有任何变化。当我尝试用 删除时间戳时notification_set_time(notification, DO_NOT_SHOW_TIMESTAMP),它给出了一个错误(DO_NOT_SHOW_TIMESTAMP未知)。

下面是代码的一部分,它涵盖了创建通知并设置其内容的整个函数。在第 20 行(标记为注释)中,我尝试添加一个带有 的按钮notification_set_button,但这导致了错误。

    void set_notification(appdata_s *ad){
    notification_h notification = NULL;
    notification = notification_create(NOTIFICATION_TYPE_NOTI);
    if(notification != NULL){

    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_add_button(notification,NOTIFICATION_BUTTON_1);
    notification_set_vibration(notification, 
    NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
    }
    app_control_h app_control = NULL;
    int noti_err = NOTIFICATION_ERROR_NONE;

    app_control_create(&app_control);
    app_control_set_app_id(app_control, "org.tizen.noti_basicui2");

    noti_err = notification_set_launch_option(notification, 
    NOTIFICATION_LAUNCH_OPTION_APP_CONTROL,
    (void *) app_control);
    if (noti_err != NOTIFICATION_ERROR_NONE) {
    notification_free(notification);
    return;
     }
    app_control_destroy(app_control);
    notification_post(notification);
    }
4

0 回答 0