Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Notification Sample Application
Tizen Ver. 2.3 Native Application Development
2015.05.23
Ajou University
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Notification Sample Application
organization
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Start Native Development
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Creating Sample Application
New > Tizen Native
Project > Sample>
Notification Manager
Sample Application
Write project name and
Click finish button.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Structure
The Notification Manager Sample application demonstrates how you can present a notification to user: create simple or ongoing notifications, remove notification, create notification with action by App Control or App Id, increase and decrease badge number. The UI part demonstrates use of genlist/list API, tabcontrol and entry. The business logic source code shows work with system app_control callback.
model main.cutils view
notification-control.c
notification.c
ongoing-notirication.c
ui-utils.c
tab-view.c
layout-view.c
window.c
main-app.c
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
/src/model/
• This module has a role of
– getting (ongoing) notification information
– deleting all (ongoing) notifications
– setting arguments to service
– increase/decrease badge count by one
• using libraries: <stdbool.h>, <notification.h>,
<badge.h>, <Eina.h>, <math.h>, <stdio.h>, <stdlib.h>
model
notification-control.c
notification.c
ongoing-notirication.c
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
/src/utils/ & /src/view/
• This module has a role of
– adding naviframe or layout widget to parent widget.
• using libraries: <Evas.h>, <Elementary.h>
utils
ui-utils.c
view
tab-view.c
layout-view.c
window.c
• This module has a role of
– adding new layout to application main window
– adding new tab to application main window
– creating/destroying application main window
– lower/raise application window
– setting content/getting window layout
• using libraries: <Evas.h>, <Elementary.h>
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
/src/
• main function
• using libraries: <tizen.h>, “main-app.h”
main.c
main-app.c • creating/destroying application instance
• running notification manager application
• using libraries: <Evas.h>, “main-app.h”, “view/window.h”,
view/, utils/, model/, <notification.h>, <app.h>,
<efl_extension.h>
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Processlooking for execution process
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Start main function
define app_data
Runs the application's main loop until
ui_app_exit() is called.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interfaceadd new window
add new naviframe
add tab view
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– tab_view_add() process
add new layout
add tab element to naviframe (parent)
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– tab_view_add() process
tab information is added
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– tab_view_switch_cb() process
check pressed toolbar is currently active or not
change pressed_toolbar_ item information
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– tab_view_switch_cb() process
if current state is ONGOING_NOTIFICATION, change it to NOTIFICATION
change tab content for NOTIFICATION
content switch function
content creation function
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– _tab_view_create_tab_content() process
add list to layoutfor filling content
call another function again to fill list
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– _tab_view_fill_list() process
append list item
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Making User Interface– _tab_view_fill_list() process
returns contents information for notification list
name: data name,callback:
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Process based on stack
main main
app_run()
_on_create_cb()
tab_view_add()
creates window, naviframe
creates layout, tab elements
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Application Process
• Process based on stack
…
tab_view_add()
_tab_view_fill() tab information (Notification, Ongoing Notification) is added
_tab_view_switch_cb()
_tab_view_create_tab_content()
_tab_view_switch_content()
creates tab content
switches tab content when tab is changed
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Notification FunctionsHow to use notification API
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
• Notification • Ongoing Notification
Notification Functions
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
• Notification
“Notify“ Process
Here this function contains list of notification tab and each of connected callback functions when clicking the list content. “Notify” calls ‘notify_cb’ function.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• notify_cb() function
It creates a notification by calling ‘create_notification()’, sets launch arguments, and posts the notification by ‘notification_post()’ function which is in <notification.h> API.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• create_notification() function
It makes a notification by calling ‘notification_create()’ in Notification API. Then it customizes its image, title text, content text, and sound.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• launch_arguments_set() function (in ‘notification-control.c’)
It creates a notification by calling ‘create_notification()’, sets launch arguments, and posts the notification by ‘notification_post()’ function which is in <notification.h> API.
....
This is setting various launch arguments such as argument, package name, uri text, mime text, operation, array result and array key for the notification options.
“AppMessage”
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• snprintf() function
It sets result messages.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• return position of the ‘notify_cb()’ callback function?– tab-view.c
It prints out result messages.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• layout_view_add() function (layout-view.c)
It prints out result messages.
gets naviframe by parent, adds new layout and fill it with notification information
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• layout_view_add() function in detail– _layout_view_fill()
In newly generated layout, you can see it fills notification information’s ‘result_text’ information which is filled in ‘notify_cb’ function.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
• completed layout
layout
title
scroller
box
content
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“Notify“ Process
“notify” notification
“TitleText”
“AlertText”
images/mainmenu.png”
no sound
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
• Ongoing Notification
“OngoingNotification(%)“ Process
Same with notification tab, this function contains list of ongoing notification tab and each of connected callback functions when clicking the list content. “OngoingNotification” calls ‘ongoing_notification_cb’ function.
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“OngoingNotification(%)“ Process
• ongoing_notification_cb() function
The only difference between notification and ongoing notification when making is a parameter in ‘notification_create’ function.
NOTIFICATION_TYPE_NOTI
NOTIFICATION_TYPE_ONGOING
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
“OngoingNotification(%)“ Process
• ongoing_notification_cb() function Process
notification exists
creates ongoing
notification
increase progress 10%
progress is full
progress value = 0
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Removing notification
• ‘remove notification’ callback function structure
choose appropriate parameter for some notifications in which you want to delete
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Badge FunctionsHow to use notification API
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Badge
• A badge is an image displayed on the application icon, which informs the user about notifications and events
• There are various functions to control badges:
– creates a badge
– removes the badge
– sets badge count
– gets badge count
– sets the display option
– gets the display option
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Badge
• In this example, badge was created when tab view was added (in tab_view_add() function, slide 19 page )
• It is controlled by two functions
get_package_name()
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Badge
• By using pointer to the parameter, you can get the number of current badges by ‘badge_get_count()’ function
• ‘increase_badge()’ function simply increase one by calling ‘badge_set_count()’ and using count value which is brought from ‘badge_get_count()’ function
• It is controlled by two functions
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Badge
• ‘decrease_badge()’ function is also similar with increasing one
• It brings current the number of badges and if there are badges more than one, the function decreases it
• It is controlled by two functions
Ajou Univrsity
Notification Sample Application (Tizen Ver. 2.3)
Summary
• In Notification Sample Application,– It uses
• Notification API
• Badge API
• EFL API (Eina, Elementary)
– You can learn• how to use notification, badge API
– ongoing notification, increasing/decreasing badge
• how to make tab gui
• how to make list gui
• how to add new layout dynamically