I´m new to Tizen, and I tried to develop a wearable native App (2.3.2) where notifications can be created by clicking on a button. So far it works, but I was wondering whether the notifications could be customized.
My questions:
- I'd like to insert a button for user interaction on the notifications. Is this possible? Is there any other way for creating a button on a notification or is this not possible in Tizen 2.3.2 for wearables?
- Is there a way to customize the popup which is (automatically?) shown every time a new notification is created (e.g. add App icon, show part of notification content...)?
- I´m not sure what time is displayed there at all - it seems completely random to me while testing on the emulator. Is it possible to delete the time stamp shown under the notification title in the notification tray? The time stamp on an notification should be possible to modify by
notification_set_time(notification, time(NULL));
, but it didn't work for me. Just showed completely random values (not the actual system time; same asnotification_set_time_to_text
at code line 9). Nothing changed in the displayed notification. When I tried instead to delete the time stamp withnotification_set_time(notification, DO_NOT_SHOW_TIMESTAMP)
, it gave an error(DO_NOT_SHOW_TIMESTAMP
is unknown).
Below is a part of the code that covers the whole function which creates the notification and sets its content. In Line 20 (marked as comment) I tried to add a button with notification_set_button
, but this caused an error.
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);
}