Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Filter
success story game, marketplace, mobile
blogjeanne hsu, senior marketing manager for developer relations at samsung, chatted with george airiyan, the development director of whalekit (part of my.games). his job entails business development and execution of all external partnerships with the help of a small research & innovations department he manages. jeanne hsu (jh): george tell us a little about you. what was your professional journey that led you to whalekit? george airiyan (ga): i’ve been in the mobile games industry for 16 years. my background is it and linguistics. while i was at the university, i started working as a programmer for it companies, leading teams and managing small software projects. then i felt i was ready for my next move and was offered a job as a project manager/producer at a mobile games company. i really loved the people, the atmosphere, and being part of the creative process so i stayed in the gaming industry and have worked with some of my colleagues for more than 15 years. jh: it sounds like the people were an important part in your journey into gaming. ga: yes. some of those people i met in the gaming industry 15 years ago, are now part of the core team at whalekit. jh: tell us about my.games. ga: my.games is an international brand with 13 regional offices in europe, the us and asia, with more than 1,800 staff employees and 14 internal studios including whalekit. my.games develops games for the pc, consoles and mobile devices. the company operates more than 80 titles with a total portfolio count of 150 games, including in-house made hits like war robots, hustle castle, rush royale, left to survive, as well as skyforge and allods online. there are more than 900 million players registered in my.games titles around the world. the company also has its own media portal, the my.games store platform, investment division mgvc, and other assets. jh: tell us about whalekit. whalekit is a team of professionals whose core members started making mobile games in 2004-2005. we have been making 2d and 3d games since the pre-smartphone era. with the adoption of smartphones, our business and operation models changed reflective of the industry: instead of “release and forget” paid titles, we shifted to games as services and free-to-play, regular live operations, social features and much more. we have always aimed at the highest possible quality level, and these days left to survive is also available on pc along with major mobile stores. whalekit is one of my.games’ largest studios with more than 120 employees. it specializes in developing hi-tech 3d-action mobile games. among the games produced by this team over the years, there are hit titles like deer hunter, contract killer, and frontline commando. in 2018, we released zombie apocalypse shooter left to survive, which found millions of mobile fans. whalekit’s vast mobile development experience allows the studio to keep trying something new, train its staff, as well as solve complex creative and technical issues. jh: how did the relationship with samsung first start? ga: we had a meeting with samsung representatives at gdc 2019 where we discussed the opportunities and agreed to work on the partnership. jh: congratulations on winning the 2021 best of galaxy store award-best action game for whalekit left to survive for samsung. what does it mean to win this award? ga: we are happy and honored to win this award. it’s a sign of appreciation for the whole team. our specialty is action games; it's something we think we do the best. we know that the game is interesting, enjoyable, and addictive. but it's always great to be recognized by the industry. jh: how did you come up with the concept for the left to survive game with players fighting the zombies that have overrun the earth? ga: our team has specialized in action and shooting titles, including zombie shooters, for a long time. we were thinking of how to take our games to the next level and realized that players wanted a deeper sense of progression and more variety in the gameplay modes. that’s how the traditional campaign mode got interconnected with base building, pvp and base raids. we noticed interesting demographic trends, with female players showing an inclination in zombie shooters as well. so we decided to take this theme and grow it. [pvp means player versus player, interactive games between human players.] jh: what are future plans for the game? ga: we know that players like our game, with many of them playing for months and even years. we are going to continue providing unique content and engaging mechanics, so more players will stay even longer. left to survive - 2021 best action game game ideas, discoverability, and reach jh: what games from my.games are on galaxy store? ga: we have left to survive and warface: global operations (both from the whalekit studio), american dad! apocalypse soon (from the nord studio), rush royale for samsung (from the itt studio) and storyngton hall (from bit.games). jh: where do you get your game ideas? ga: everybody in the studio can come up with their own ideas. we don’t limit ourselves to a certain genre or theme. naturally the overall potential is estimated by studio experts when we decide to proceed with a new idea. jh: how does it mesh with your motto “free to create and ready to explore”? ga: we sometimes have game jams. it's sort of a standard thing for the gaming industry, when a studio breaks down into several small teams, not the whole studio, just those who want to participate. they’ll spend one day, two days, or a three-day weekend, creating prototypes of the games that they think are fun. then everybody in the studio looks at them, and votes for the top idea for the best implementation. some of them even make it further to prototypes of real games that could be a potential future project. as for the idea of exploration, these game jams aren't limited to any theme or genre or scale. it could be anything. jh: with all the competition for games, what has been your strategy for discoverability? ga: making a great game always comes first. while discoverability isn’t trivial, as long as the game has good metrics, our marketing team will do their best to advertise it on various channels. it's also important to optimize app pages and work closely with the stores. jh: what platform do you use to develop your games? ga: we use unity 3d. it allows us to create high quality visuals on a wide variety of devices. we programmatically detect the hardware in terms of performance. for lower-end devices, we show optimized graphics, switching out some of the visual effects so people can still play it. the game is not as visually rich at the lower end, but it's still playable. but for higher-end devices, we switch on all the bells and whistles. we’re quite happy with what unity allows us to do. jh: on your website, it says my.games has $562m in annual revenue (2020 figures). that’s amazing. what has been your strategy for generating revenue? ga: there are several factors at play here. primarily it’s the company’s diversified portfolio with 150 titles across various genres for different audiences. anyone can find what they’re looking for in the my.games catalog. the second factor is that we are proactively developing our mobile projects as the mobile market is the biggest and fastest-developing sector and therefore more promising. 75% of our revenue accounts for it. finally, the third factor is our global focus. this is why international sales accounted for 77% of my.games revenue in q3 2021, with the u.s., germany and france as the top markets. jh: why is it important to offer your game on galaxy store? ga: galaxy store is a great way to increase the player base in important territories. the biggest territory for gaming companies is the united states, of course. and we see quite good coverage in the u.s. for galaxy store. it’s been a very positive experience for us. marketing and user acquisition jh: what are some of the ways you promote left to survive? ga: here are our websites and channels: my.games: https://my.games/ left to survive: https://lts.my.games/ facebook: https://www.facebook.com/lefttosurvive youtube: https://www.youtube.com/c/whalekitgames/featured jh: i noticed you have left to survive video trailers for your active facebook community. ga: we actually use some of these trailers for user acquisition. we have an in-house team to produce these video creatives. some of them are really cool. some of them are quite funny. this is something we pay quite a lot of attention to. because nowadays, most of the user acquisition is done via advertising in other applications. it’s done with videos; every company does that as a standard way of looking for new users. you just show your ads in somebody else's application and people may click on it. jh: i see the trailer for the game like a movie trailer at the theaters or online; if it looks interesting, i will make a mental note to go see it. maybe after watching the trailer for left to survive, i’ll want to learn more about the game and try it. very clever. diversity and inclusion jh: what is my.games doing related to diversity and inclusion? ga:. my.games believes in equal opportunities for everyone. we never look at nationality, race, sex or beliefs. the ratio of women to men, for instance, is around 40% to 60% and growing. it’s quite common to see women in all positions, including management, engineering, marketing, game design, qa. jh: what do you do for fun outside of work? ga: i love playing beach volleyball. even in winter, when there’s snow outside, there are indoor “beaches” where you can play beach volleyball. jh: i’ve never heard of an indoor beach. ga: yeah, they bring in net posts and lots of sand. it’s a lot of fun. jh: what else? ga: i love sports as a whole. i used to play quite a lot of football (soccer). i love travelling with my wife and three-year-old son. we’ll take a car and drive somewhere. of course, with a small kid, it's not as easy. but now he's growing up and can handle longer journeys. we’ll do more of this again. jh: thank you for your time george. it’s been a pleasure getting to know you and whalekit. congratulations again to your team! ga: you’re welcome.
Jeanne Hsu
Develop Samsung Browser
docweb development guide samsung internet for android provides many features to make browsing smooth and convenient on samsung galaxy devices here are some tips to make your web sites fully utilize our features, supported since the indicated version in each section the latest stable version is 6 2 samsung internet for android 6 x css grid version 6 0 introduced support for css grid, enabling web developers to better control how elements are arranged in multiple rows and columns to get started with grid, here is a guide which features examples for common responsive layouts samsung internet for android 5 x progressive web app indication badge since version 5 2, samsung internet detects when the page being viewed is a progressive web app, i e if the user can add it to their home screen and launch it as a standalone web application, even if they are offline if this is the case, the usual bookmark star icon in the url bar will be dynamically changed to a special 'plus' icon this provides a shortcut to add the web app to the homescreen, as well as bookmark it the criteria we use to display the icon are as follows the site is served over https the site registers a service worker the site registers a web app manifest the web app manifest has name or short_name the web app manifest has start_url the web app manifest has an icon where size is at least 144x144 the web app manifest has display set to 'standalone' or 'fullscreen' the exact criteria may be subject to change in the future samsung dex since v5 2, samsung internet supports samsung dex, providing a desktop browsing experience it is recommended to use responsive design to ensure that your site works well in larger desktop windows if you need to determine whether your site is being viewed in dex, you can check the user-agent string here is an example user-agent string when the browser is in dex mode mozilla/5 0 x11; linux x86_64 applewebkit/537 36 khtml, like gecko samsungbrowser/5 2 chrome/51 0 2704 106 safari/537 36 for comparison, here is an example user-agent string for the mobile browser not in dex mode mozilla/5 0 linux; android 7 0; samsung sm-g935f build/nrd90m applewebkit/537 36 khtml, like gecko samsungbrowser/5 0 chrome/51 0 2704 106 mobile safari/537 36 the progressive web app indication badge also applies to samsung internet for dex progressive web apps can have their own icon in the tray and on the desktop they can be launched in a standalone, resizable window, without the url bar the same criteria for the badge apply as above web payments and samsung pay since version 5 0, samsung internet supports the payment request api, providing a consistent, easy-to-use and secure check-out experience samsung internet also supports samsung pay as a payment method, subject to samsung pay availability by location see here for further details closeby introduced in version 5 2, closeby is samsung’s physical web service, allowing you to discover contextual websites based on the locations around you closeby detects physical web beacons that broadcast web pages using the eddystone-url format to enable closeby and see the list of beacons around you, see the extensions menu while enabled, you may see a silent notification displayed when nearby beacons are detected for a beacon to be displayed by closeby, the page that the url resolves to must be served over https must not be blocked by robots txt must not include malicious contents/ malware must be found and reachable, without timing out must not have an ssl certificate error must not be empty samsung internet for android 4 x custom tabs apps often need to provide users with a way to view web pages previously this required embedding a webview inside your app, or launching a browser and making the user come back to your app later since samsung internet for android 4 0, app developers can have more control over the overall web experience without using android webview, by launching a lightweight custom tab the followings are customizable for custom tabs menu items toolbar color samsung internet custom tabs service connection client apps can use the sample code below for connecting to custom tabs service provided if bindservice throws an exception, custom tabs is not supported in the installed version the package name must be set to samsung internet’s package name i e "com sec android app sbrowser" // package name of samsung internet public static final string samsung_internet_package_name = "com sec android app sbrowser"; // action for the service intent public static final string custom_tabs_connection = "android support customtabs action customtabsservice"; intent serviceintent = new intent custom_tabs_connection ; serviceintent setpackage samsung_internet_package_name ; context bindservice serviceintent, mserviceconnection, context bind_auto_create | context bind_waive_priority ; launching a custom tab once binding the custom tabs service, you can use an action\_view intent to launch a custom tab from your app // package name of samsung internet public static final string samsung_internet_package_name = "com sec android app sbrowser"; // action for the service intent public static final string custom_tabs_connection = "android support customtabs action customtabsservice"; intent serviceintent = new intent custom_tabs_connection ; serviceintent setpackage samsung_internet_package_name ; context bindservice serviceintent, mserviceconnection, context bind_auto_create | context bind_waive_priority ; customizing menu items client apps can add customized menu items to the custom tab the menu items are added using an array of bundles that consist of menu texts and pending intents // key for title string for custom menu item public static final string custom_tabs_menu_title = "android support customtabs customaction menu_item_title"; // key for pending intent public static final string custom_tabs_pending_intent = "android support customtabs customaction pending_intent"; // array list is used for specifying menu related params public static final string custom_tabs_extra_menu_items = "android support customtabs extra menu_items"; arraylist menuitembundlelist = new arraylist<bundle> ; // separate bundle for each menu item bundle menuitem = new bundle ; menuitem putstring custom_tabs_menu_title, menuitemtitle ; menuitem putparcelable custom_tabs_pending_intent, pendingintent ; menuitembundlelist add menuitem ; intent putparcelablearraylist custom_tabs_extra_menu_items, menuitembundlelist ; customizing toolbar color the color of the custom tab’s tool bar can be changed to be in sync in caller apps’ theme using intent extra // intent extra for changing the color for tool bar color of type int indicates a color private static final string custom_tabs_toolbar_color = "android support customtabs extra toolbar_color"; intent putextra custom_tabs_toolbar_color, color ; service worker service worker support was introduced in samsung internet for android 4 0, based on chromium 44 2403 with some additions and changes additions client manipulation client id windowclient navigate url navigator serviceworker serviceworkercontainer getregistrations registration serviceworkerregistration update that returns a promise cache cache addall requests cache matchall request, options changes client manipulation client postmessage message, transfer will result in a serviceworkermessageevent being fired on navigator serviceworker instead of a messageevent being fired on the client’s global window object clients matchall returns clients in mru order registration serviceworkerregistration update will only bypass the browser cache if the previous update check occurred over 24 hours ago cache api cache api is restricted to secure origins can be only used with https fetch related fetch api request flags for navigation requests have been changed from <mode "no-cors", credentials "same-origin"> to <mode "same-origin", credentials "include", redirect "manual"> fetchevent respondwith accepts cors responses for page loading or worker script loading requests web push web push notification allows users to "subscribe" to receive notifications from a web page, and users will receive the notification whether the web page is currently running or not push api depends on service workers to provide the offline functionality needed web push support was introduced in samsung internet for android 4 0 samsung internet for android 3 x quick access as one of the default homepages for samsung internet for android since version 3, the quick access page enables users to visit their favorite sites with a single click it is also loaded whenever users click the url bar giving your sites more exposure and leading more users to you quick access page contains a default list of sites that is adjustable by the user the default list varies according to countries, regions, carriers, etc it is updated independently from the samsung internet for android through the samsung quick access server for more effective exposure, we recommend adding a catchy icon that shows off the characteristics of your page the icon displayed for your site will be determined following this priority the apple-touch-icon declared in the content ex <link rel="apple-touch-icon" href="/mytouchicon png"> the favicon set up in the content ex <link rel="icon" href="/myicon png"> a simple icon created by the samsung quickaccess server shortcut promotion banner based on the w3c manifest for web application standard, samsung android for internet lets web pages look and work more like native android applications with the ‘add to home’ feature, users are able to install your pages to their devices and launch and explore them without being aware of the browser container since version 3 0, samsung internet for android promotes ‘add to home’ with notification banners samsung internet for android will recommend shortcut installation for frequently* visited sites if it has a manifest declared in a link element this will give users easy access to the feature and certainly make users access your contents more frequently of course, samsung internet for android still provides the ‘add to home’ menu so users can install web applications to their home screens without going through the promotion banner * currently, the notification will show when the user visits a site at least 3 times during a 2 week period this policy may change secure web auto login using fingerprint authentication, samsung internet for android provides a more secure and easy way for users to login to sites once the user agrees to save their login info for a site, future sign-ins will be done with a single fingerprint scan after the user identity is verified with fingerprint, the password field is auto-filled and submitted for login where applicable since samsung internet for android 3 2, the number of sites supported for auto login has been highly increased use standard html forms and avoid overriding the ‘enter’ key to make the best use of this feature <form action="example_form asp"> id <input type="text" name="username" value="username"><br/> password <input type="password" name="password" value="password"><br/>> <input type="submit" value="submit"> </form> audio notification since version 3 0, samsung internet for android lets you provide audio contents to users with the experience of native music applications users can keep listening to audio streaming from your sites after switching to other tabs or applications the samsung internet for android icon is shown in the notification bar to indicate that audio streaming is coming from the web and when the user opens the notification drawer, a mini-controller for the audio element is displayed to enable quick and easy control of audio playback this mini-controller is also displayed on the lock screen for user convenience an icon and the title of the current audio streaming are shown in the mini-controller the icon displayed is determined following this priority the apple-touch-icon declared in the content ex <link rel="apple-touch-icon" href="/mytouchicon png"> the favicon set up in the content ex <link rel="icon" href="/myicon png"> a simple icon created by the samsung quickaccess server
Develop Galaxy Watch for Tizen
doccreate your first tizen wearable native application welcome to tizen wearable native application development! a wearable native application is created using the c language, and can be run on tizen wearable devices the application uses the native api, which provides various interfaces to the device hardware allowing you to take advantage of numerous capabilities tailored to run with limited device resources study the following instructions to help familiarize yourself with the tizen native application development process as well as using the tizen studio and installing the created application on the emulator or target device with the instructions, you can create and run a basic wearable native application, which displays some text on the screen with no user interaction before you get started with developing tizen applications, download and install the tizen studio for more information on the installation process, see the installation guide create a wearable native project using the tizen studio this step shows how you can use a predesigned project template that creates all the basic files and folders required for your project build the application after you have implemented code for the features you want, this step shows how you can build the application to validate and compile the code run the application this step shows how you can run the application on the emulator or a real target device design a ui this step shows how you can create the application ui and make small alterations to it to improve the usability of your application when you are developing a more complex application, you can take advantage of the native tools included in the tizen studio to ease the tasks of creating functionality and designing the application ui creating a project the following example shows you how to create and configure a basic wearable native application project in the tizen studio an application project contains all the files that make up an application the following figure illustrates the application to be created the application screen displays the hello tizen text and no user interaction is provided if you click the back key on the device, the application moves to the background figure wearable native basic ui application to create the application project launch the tizen studio in the tizen studio menu, select file > new > tizen project the project wizard opens in the project wizard, define the project details the project wizard is used to create the basic application skeleton with the required folder structure and mandatory files you can easily create different applications by selecting an applicable template or sample for the project wizard to use select the template project type and click next select the profile wearable and version from a drop-down list and click next the version depends on the platform version you have installed and with which you are developing the application select the native application application type and click next select the basic ui template and click next define the project properties and click finish you can enter the project name 3-50 characters and the unique package id you can also select the location and working sets by clicking more properties the project wizard sets up the project, creates the application files using the default content from the template, and closes for more information on the project wizard and the available templates, see creating tizen projects with tizen project wizard you can see the created project in the project explorer view the most important files and folders include inc default folder for included source files res folder for resource files used by the application only shared folder for resource files to be shared with other applications src folder for source code files lib folder for external library files tizen-manifest xml manifest file used by the platform to install and launch the application figure application in the project explorer note you can view and modify the application configuration in the manifest editor in this example, no configuration changes are required your application project is now ready for further actions next, build the application managing the application configuration to view and modify the application configuration in the project explorer view, double-click the tizen-manifest xml file of the application the tizen studio opens the file in the manifest editor in the manifest editor, view and modify the configuration details using the various tabs overview define general information, such as the package, label, and icon of the application features define required software and hardware features this information is used for application filtering in the tizen store privileges define the security-sensitive apis or api groups accessed and used by the application localization define localized values for the application label, description, and icon advanced define advanced features, such as application metadata, data control for services, application control functionalities, and account details source view and edit the source code of the tizen-manifest xml file changes made and saved on the other tabs are reflected in the source code and vice versa note the tizen-manifest xml file must conform to both the xml file format and the tizen native application specification requirements editing the file in the source tab is intended for advanced users only to save any changes, in the tizen studio menu, select file > save all for more information on configuring the application, see setting the application manifest understanding the source code pay attention to the life-cycle callbacks in the application source code, to understand how the application works for source code details related to the ui, see designing a simple ui the main function in the src/basicui c file is used to register callbacks that manage specific parts of the application life-cycle app_create called when the application process starts used to create ui components app_terminate called while the application process is terminating called after the main loop quits app_resume ui applications only called when the application window is shown app_pause ui applications only called when the application window is totally hidden app_control called after the app_create callback when the process starts called when a launch request is received while the process is running can receive app_control data parameters for launching the application used to implement parameter-specific actions of the application int main int argc, char *argv[] { appdata_s ad = {0,}; int ret = 0; ui_app_lifecycle_callback_s event_callback = {0,}; app_event_handler_h handlers[5] = {null,}; event_callback create = app_create; event_callback terminate = app_terminate; event_callback pause = app_pause; event_callback resume = app_resume; event_callback app_control = app_control; ret = ui_app_main argc, argv, &event_callback, &ad ; if ret != app_error_none dlog_print dlog_error, log_tag, "app_main failed err = %d", ret ; return ret; } building your application after you have created the application project, you can implement the required features in this example, only the default features from the project template are used, and no code changes are required when your application code is ready, you must build the application the building process performs a validation check and compiles your files you can build the application in the following ways automatically the automatic build means that the tizen studio automatically rebuilds the application whenever you change a source or resource file and save the application project to use the automatic build select the project in the project explorer view in the tizen studio menu, select project > build automatically a check mark appears next to the menu option you can toggle the automatic build on and off by reselecting project > build automatically manually the manual build means that you determine yourself when the application is built to manually build the application, right-click the project in the project explorer view and select build project figure manually building the application alternatively, you can also select the project in the project explorer view and do one of the following in the tizen studio menu, select project > build project press the f10 key you can have more than one build configuration to see the current active configuration or change it, right-click the project in the project explorer view and select build configurations > set active the default configuration is debug for more information, see building applications after you have built the application, run it running your application you can run the application on the emulator or a real target device running on the emulator to run the application on the emulator launch an emulator instance in the emulator manager in the tizen studio menu, select tools > emulator manager in the emulator manager, select a wearable emulator from the list and click launch if no applicable emulator instance exists, create a new one the emulator is launched in its own window you can also see the new emulator instance and its folder structure in the device manager generate a security profile before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have created multiple emulator instances, select the instance you want from the combo box in the toolbar before selecting to run the application if you select an offline emulator, it is automatically launched when you select to run the application confirm that the application launches on the emulator note if the emulator display has switched off, you cannot see the application launch to switch the display on, click the power key in the lower-right corner of the emulator while the application is running, the **log** view in the tizen studio shows the log, debug, and exception messages from the methods defined in the log macros to see the view, in the tizen studio menu, go to **window \> show view \> log** for more information on using the emulator features, see using emulator control keys, menu, and panel and using extended emulator features running on a target device to run the application on a target device connect the wearable target device to your computer define settings on the device go to settings > connections, and switch on wi-fi the device and the computer must be connected to the same wi-fi network note the ip address the device is using go to settings > gear info, and switch on the debugging mode use the remote device manager to connect the wearable device in the device manager, launch the remote device manager by clicking the related icon in the remote device manager window, click + in the add device window, enter the device and network details use the ip address you noted before , and click add in the remote device manager window, switch the new device on by clicking the switch under connect the device asks for user confirmation to allow gear to read log data, copy files to and from your computer, and install the application manually, click the accept mark in the device manager, confirm that the device is connected shown in the device list generate an author certificate before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the device manager, select the device in project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have both a connected device and existing emulator instances, select the device from the combo box in the toolbar before selecting to run the application confirm that the application launches on the target device note the application is launched using the default debug run configuration to create and use another configuration in the project explorer view, right-click the project and select run as > run configurations in the run configurations window, click the new launch configuration icon , define the configuration details, and launch the application by clicking run designing a simple ui the wearable application created with the basic ui template has a simple user interface with a label component showing the hello tizen text at the top of the screen the ui is created using efl figure user interface in the basic ui template creating the basic ui the ui in the basic ui template contains the following components the efl ui always contains a window component, which is the root component of the entire ui since the application has the indicator bar at the top of the screen, it requires the conformant component the text label is implemented with a label component the ui is created in the basicui c file data structure a pointer to the ui components is stored in the appdata_s data structure struct appdata { /* window */ evas_object *win; /* conformant */ evas_object *conform; /* label */ evas_object *label; }; typedef struct appdata appdata_s; ui creation the app_create life-cycle callback is called when the application main loop starts, and it calls the create_base_gui function to create the ui static bool app_create void *data { /* hook to take necessary actions before the main event loop starts initialize ui resources and application data if this function returns true, the application main loop starts if this function returns false, the application is terminated */ appdata_s *ad = data; create_base_gui ad ; return true; } ui components the create_base_gui function creates the ui components window, conformant, and label the function receives a pointer to fill in the appdata_s structure static void create_base_gui appdata_s *ad { the window component is created with the elm_win_util_standard_add function callbacks are also added for the window one of the callbacks handles the delete,request event when the window is to be closed, and the other handles the eext_callback_back event when the hardware back key is pressed /* window create and initialize elm_win, which is mandatory to manipulate a window */ ad->win = elm_win_util_standard_add package, package ; elm_win_autodel_set ad->win, eina_true ; if elm_win_wm_rotation_supported_get ad->win { int rots[4] = {0, 90, 180, 270}; elm_win_wm_rotation_available_rotations_set ad->win, const int * &rots , 4 ; } evas_object_smart_callback_add ad->win, "delete,request", win_delete_request_cb, null ; eext_object_event_callback_add ad->win, eext_callback_back, win_back_cb, ad ; the conformant component is needed to show the indicator bar at the top of the screen the component is the first object added inside the window with the elm_conformant_add function the elm_win_indicator_mode_set function decides whether the indicator is visible, and the elm_win_indicator_opacity_set function sets the indicator opacity mode the conformant component is set as a resize object of the window by using the elm_win_resize_object_add function it means that the conformant size and position are controlled by the window component directly the evas_object_show function makes the conformant component visible /* conformant create and initialize elm_conformant, which is mandatory for the base gui to have a proper size when an indicator or virtual keypad is visible */ ad->conform = elm_conformant_add ad->win ; elm_win_indicator_mode_set ad->win, elm_win_indicator_show ; elm_win_indicator_opacity_set ad->win, elm_win_indicator_opaque ; evas_object_size_hint_weight_set ad->conform, evas_hint_expand, evas_hint_expand ; elm_win_resize_object_add ad->win, ad->conform ; evas_object_show ad->conform ; the label component for the text is added with the elm_label_add function the label is added inside the conformant component, which is the label's parent the label text is set with the elm_object_text_set function /* label create an actual view of the base gui modify this part to change the view */ ad->label = elm_label_add ad->conform ; elm_object_text_set ad->label, "<align=center>hello tizen</align>" ; evas_object_size_hint_weight_set ad->label, evas_hint_expand, evas_hint_expand ; elm_object_content_set ad->conform, ad->label ; when all the ui components are ready, the evas_object_show function makes the window component visible this means that the window displays everything on the screen at once /* show the window after the base gui is set up */ evas_object_show ad->win ; } modifying existing components when the basic ui exists, you can easily modify the components in the ui by using the component-specific functions, or more general evas object functions for example, the following modifications to the label component change the label style to a marker making the text bold and increase the font size to 50 /* label */ ad->label = elm_label_add ad->conform ; elm_object_text_set ad->label, "<align=center><font_size=50>hello tizen</font/></align>" ; elm_object_style_set ad->label, "marker" ; evas_object_size_hint_weight_set ad->label, evas_hint_expand, evas_hint_expand ; elm_object_content_set ad->conform, ad->label ; figure modified label component adding more components and functionality the basic ui only contains one visible label component you can use it as a basis to design a more elaborate ui with more components, screens, and functionality the following example shows how to add a list to the existing view screen , and how to create a second view and move between the 2 views all the code changes in this section are made within the create_base_gui function, unless stated otherwise to add more content to the ui modify the existing label view to contain a list too to add more components, first create a container that can hold all the various components in one view in this example, the box container is used it is created and added to the conformant the new list is created, and then the new list and the existing label component are both added to the box add the box and list objects to the appdata_s data structure struct appdata { evas_object *win; evas_object *conform; evas_object *label; /* box */ evas_object *box; /* list */ evas_object *list; }; typedef struct appdata appdata_s; create the box component using the conformant as the parent, and set the box as the conformant content ad->box = elm_box_add ad->conform ; evas_object_size_hint_weight_set ad->box, evas_hint_expand, evas_hint_expand ; evas_object_show ad->box ; elm_object_content_set ad->conform, ad->box ; modify the existing label component to use box as a parent, and add it to the box /* modify the label code */ ad->label = elm_label_add ad->box ; elm_object_text_set ad->label, "<align=center>hello tizen</align>" ; evas_object_size_hint_weight_set ad->label, 0 0, 0 0 ; /* comment out the elm_object_content_set function */ /* elm_object_content_set ad->conform, ad->label ; */ evas_object_size_hint_align_set ad->label, evas_hint_fill, evas_hint_fill ; evas_object_size_hint_min_set ad->label, 50, 50 ; /* show and add to box */ evas_object_show ad->label ; elm_box_pack_end ad->box, ad->label ; create the list and add it to the box create a list component with the elm_list_add function the box component is the parent of the new list component add items to the list with the elm_list_item_append function int i; /* create the list */ ad->list = elm_list_add ad->box ; /* set the list size */ evas_object_size_hint_weight_set ad->list, evas_hint_expand, evas_hint_expand ; evas_object_size_hint_align_set ad->list, evas_hint_fill, evas_hint_fill ; for i = 0; i < 4; i++ { char tmp[8]; snprintf tmp, sizeof tmp , "item %d", i + 1 ; /* add an item to the list */ elm_list_item_append ad->list, tmp, null, null, null, null ; } /* show and add to box */ evas_object_show ad->list ; elm_box_pack_end ad->box, ad->list ; when you run the application, the screen now shows the label at the top and the list in the middle create another view and navigate between the views the previous step created a view that contained a box component with a list component in the box to create an application with multiple views, you need to add a naviframe component to the application add the naviframe and naviframe item objects to the appdata_s data structure struct appdata { evas_object *win; evas_object *conform; evas_object *label; evas_object *box; evas_object *list; /* naviframe */ evas_object *navi; /* item */ elm_object_item *navi_item; }; typedef struct appdata appdata_s; create the naviframe using the conformant as the parent ad->navi = elm_naviframe_add ad->conform ; evas_object_show ad->navi ; elm_object_content_set ad->conform, ad->navi ; modify the box component to have the naviframe as a parent ad->box = elm_box_add ad->navi ; evas_object_size_hint_weight_set ad->box, evas_hint_expand, evas_hint_expand ; evas_object_show ad->box ; elm_object_content_set ad->navi, ad->box ; push the box to the naviframe as a top item to create the first view the second parameter defines a title text for the view each application view is a separate item in the naviframe, and the top item is always displayed ad->navi_item = elm_naviframe_item_push ad->navi, "first view", null, null, ad->box, null ; create the navigation between the views by adding a clicked,double event callback to the list when the user double-clicks the item, the second view opens for clarity, change the first list item text to go to second /* change the first list item text */ elm_object_item *it; it = elm_list_first_item_get ad->list ; elm_object_item_text_set it, "go to second" ; /* add a callback */ evas_object_smart_callback_add ad->list, "clicked,double", list_item_doubleclicked_cb, ad->navi ; in the list item double-click event callback, define the content for the second view create a prev button to return to the first view, and push the button to the naviframe as a new top item also create the prev button callback for popping the top item from the naviframe, and consequently displaying the first view add both the new functions before the create_base_gui function static void prev_btn_clicked_cb void *data, evas_object *obj, void *event_info { evas_object *nf = data; elm_naviframe_item_pop nf ; } static void list_item_doubleclicked_cb void *data, evas_object *obj, void *event_info { evas_object *navi_button; evas_object *nf = data; elm_object_item *nf_it; navi_button = elm_button_add nf ; elm_object_text_set navi_button, "prev" ; elm_object_style_set navi_button, "bottom" ; evas_object_smart_callback_add navi_button, "clicked", prev_btn_clicked_cb, nf ; nf_it = elm_naviframe_item_push nf, "second view", null, null, navi_button, null ; }
tutorials mobile
blogsamsung wallet enables users to easily access various digital content, such as boarding passes, tickets, and coupons, on their samsung device. users can save the content to their samsung wallet by clicking an “add to wallet” button or link. this article describes how to integrate your digital content with samsung wallet. each piece of digital content is represented by a wallet card which you must create and launch within the samsung wallet portal. after successfully launching the card, you can create an “add to wallet” link for it. prerequisites before you can create wallet cards for samsung wallet, complete the samsung wallet partner registration and onboarding process, including encryption setup. after onboarding, you receive an email with your public key and signed security certificate. keep this information in a safe place. important your company can only obtain partnership for a single samsung account. store your private key securely, as it is needed for wallet card management. your encryption settings cannot be modified without administrator approval. creating wallet cards samsung wallet supports the following wallet card types: boarding pass event ticket coupon gift card loyalty card id card create your wallet card at the samsung wallet portal. you can create as many cards as you need. the samsung wallet portal also allows you to manage your cards and monitor their performance. testing wallet cards use the “add to wallet” test tool to test the card at any time, before or after launching it: in the samsung wallet portal, enable testing mode for the card you want to test. skip this step if you have already launched the card. on your samsung device, go to the “add to wallet” test tool and sign in with your samsung account. select the card from the list and provide test data in the appropriate fields. in the “partner’s private key” field, paste your decrypted private key. this must be the same private key that was used during onboarding. noteif your private key is encrypted, you must first decode it with the ssl command. an encrypted key starts with the following text: -----begin encrypted private key----- once decoded, the key starts with the following text: -----begin private key----- 5. tap the “add to samsung wallet” button to add the card to samsung wallet on your device. for more information about testing wallet cards, see “add to wallet” test tool. launching wallet cards when you are ready to make the wallet card accessible to users, click “launch” to start the verification process. launching a card cannot be canceled. figure 1: wallet card launched the samsung wallet administrator reviews the card and approves or rejects it. if your card is rejected, check the rejection email for the reason. modify the card to address the issue and launch it again. for more information about wallet card verification, see launch wallet cards (verifying status) and launch wallet cards (rejected status). implementing “add to wallet” links after launching your wallet card, create a link that users can click to add the content to their samsung wallet. to include the card data in tokenized form, use the following url format: https://a.swallet.link/atw/v1/{card id}#clip?cdata={cdata token} where: {card id} path parameter is the unique identifier for the wallet card in the samsung wallet portal. #clip hash parameter is case-sensitive. cdata query parameter contains the encrypted card data in jwt format. for more information, see the "cdata token generation" section below. if the encrypted card data is longer than 2048 bytes, or you do not want to include the tokenized data in the url, store and reference the card data on your server. create the url in the following format: https://a.swallet.link/atw/v1/{card id}#clip?pdata={reference id} where: {card id} path parameter is the unique identifier for the wallet card in the samsung wallet portal. #clip hash parameter is case-sensitive. pdata query parameter is the unique identifier for the card data stored on your server. for more information on “add to wallet” links, see add to wallet interface. cdata token generation the card data in basic json format must be provided as a jwt (json web token). for token generation details, see security. you can also study the cdata generation sample code. to ensure your cdata token is valid, keep the following requirements in mind: pay attention to the mandatory fields in the card object. all timestamps are utc epoch time in milliseconds. card data attributes vary based on the card type. for detailed card data specifications, see wallet cards. your private key must match the key used for the security certificate signed by samsung. if you are using the correct private key, the following commands generate the same hash: $ openssl rsa -noout -modulus -in partner.key | openssl md5 $ openssl x509 -noout -modulus -in partner.crt | openssl md5 generated jwt tokens expire in 30 seconds. the “add to wallet” link must be used within this time. otherwise, you must generate a new token and new link. next steps to integrate the “add to wallet” feature as a button in your application or website, see implement the button. you can update the information on a card that has been stored in a user’s samsung wallet by communicating between your server and the samsung server. for information, see server interaction. if you have any questions or face difficulties implementing the content in this article, you can contact samsung developer support. related resources samsung wallet documentation integrate “add to samsung wallet” button into partner services code lab
M. A. Hasan Molla
Develop Samsung Wallet
docpay as you go { "cardtemplate" { "prtnrid" "4082825513190138240", "templaterefid" "2138240408282551318", "title" "wallet card title", "prtnrapppckgname" "prtnrapppckgname", "countrycode" "us", "desc" "desc", "cardtype" "payasyougo", "subtype" "evcharges", "applogoimg" "http //www yourdomain com/banner_logo_image png", "nonetworksupportyn" "n", "sharebuttonexposureyn" "y", "privacymodeyn" "n", "preventcaptureyn" "n" } } generic card { "cardtemplate" { "prtnrid" "4082825513190138240", "templaterefid" "2138240408282551319", "title" "wallet card title", "prtnrapppckgname" "prtnrapppckgname", "countrycode" "us", "desc" "desc", "cardtype" "generic", "subtype" "others", "applogoimg" "http //www yourdomain com/banner_logo_image png", "designtype" "generic 02", "nonetworksupportyn" "n", "category" "membership", "privacymodeyn" "n", "preventcaptureyn" "n" } } layout specs this document provides detailed specifications for the layout field used when adding wallet card templates through the card management api it is intended to be referenced from the layout field description in the adding wallet card template overview this section describes the specification of the layout field used when adding wallet card template the layout object defines presentation rules for card data in samsung wallet it does not contain display values directly instead, it references card data using attribute keys layout object structure the layout object consists of three sections header primary auxiliary each section defines a layout preset and a list of entry mappings type value description layout object layoutobject optional defines presentation rules for card data in samsung wallet layout headerobject required defines the header area of the card layout header presetstring 10 required header layout preset allowed values logo, logotext, text layout header entries[]array of object required list of entry mappings that define how header ui slots reference card data layout header entries[] entrynamestring 100 required identifier of the ui slot format {role}_{index} e g , image_01, field_01, subfield_01 layout header entries[] entrykeystring 100 required attribute key used to retrieve the corresponding data value layout primaryobject required defines the primary content area of the card layout primary presetstring 20 required primary layout preset generic cards landscape, square, vertical, textonlyboarding pass threefields, fourfields, fivefields layout primary entries[]array of object required list of entry mappings that define how primary ui slots reference card data layout primary entries[] entrynamestring 100 required identifier of the ui slot format {role}_{index} e g , image_01, field_01, subfield_01 layout primary entries[] entrykeystring 100 required attribute key used to retrieve the corresponding data value layout primary useboardingtimeboolean optional controls which time is displayed on the boarding pass card - false default displays the departure time- true displays the boarding start timeapplies only when cardtype = boardingpass layout auxiliaryobject required defines additional information displayed when the card is expanded layout auxiliary presetstring 20 optional defines the number of fields to be displayed allowed values twofields, threefields, fourfields layout auxiliary entries[]array of object required ordered list of fields rendered as label–value pairs each value is an attribute key layout auxiliary entries[] entrynamestring 100 required identifier of the ui slot format {role}_{index} e g , image_01, field_01, subfield_01 layout auxiliary entries[] entrykeystring 100 required attribute key used to retrieve the corresponding data value example { "layout" { "header" { “preset” "logotext", "entries" [ { "entryname" "image_01", "entrykey" "providerlogo" }, { "entryname" "field_01", "entrykey" "providername" }, { "entryname" "subfield_01", "entrykey" "vehiclenumber" } ] }, "primary" { “preset” "square", "entries" [ { "entryname" "image_01", "entrykey" "wideimage" }, { "entryname" "field_01", "entrykey" "grade" }, { "entryname" "field_02", "entrykey" "seatclass" } ] }, "auxiliary" { “preset” "twofields", "entries" [ { "entryname" "field_01", "entrykey" "entrance" }, { "entryname" "field_02", "entrykey" "seatnumber" } ] } } } header – required entryname by preset preset required entryname description logo image_01, subfield_01 logo image with secondary text logotext image_01, field_01, subfield_01 logo image with primary and secondary text text field_01, subfield_01 primary and secondary text without image primary – required entryname by preset preset required entryname description landscape image_01 landscape image only square image_01, field_01, field_02 square image with two text fields vertical image_01, field_01, field_02 vertical image with two text fields textonly field_01 single text field without image primary / auxiliary – field-based presets preset required entryname description twofields field_01, field_02 displays two label–value pairs threefields field_01, field_02, field_03 displays three label–value pairs fourfields field_01, field_02, field_03, field_04 displays four label–value pairs fivefields field_01, field_02, field_03, field_04, field_05 displays five label–value pairs allowed where applicable data mapping layout → card data the layout object does not contain display values each field defined in layout references card data using an attribute key this section describes how attribute keys are resolved data resolution rule when a field is defined in layout, the value is resolved from the following locations in order card data[] attributes card data[] attributes extendedfields[] entrykey standard attribute mapping if the entrykey defined in layout matches a field inside card data[] attributes the value is resolved directly from that attribute example layout … "primary" { … “preset” "square", "entries" [ { "entryname" "field_01", "entrykey" "providername " }, … } … example card data[] "attributes" { … "providername" "samsung wallet" … } extended fields mapping in addition to predefined attributes, layout fields may reference values inside extendedfields extendedfields is a user-defined data container that allows partners to define additional fields not included in the standard card specification extendedfields structure { "card" { "data" [ { … "attributes" { … "extendedfields" [ { "label" "gate", "value" "a12", "entrykey" "gatenumber" }, { "label" "zone", "value" "3", "entrykey" "boardingzone" } ] } } ] } } extendedfields resolution logic if the layout field key does not exist in predefined attributes the system searches attributes extendedfields[] entrykey when a matching entrykey is found value → resolved from extendedfields[] value label → resolved from extendedfields[] label example layout referencing extendedfields … "auxiliary" { “preset” "twofields", "entries" [ { "entryname" "field_01", "entrykey" "gatenumber" }, { "entryname" "field_02", "entrykey" "boardingzone" } ] } … result • gatenumber → value "a12", label "gate" • boardingzone → value "3", label "zone" mapping priority if the same key exists in both • predefined attributes • extendedfields the resolution priority is • attributes predefined fields • extendedfields summary • layout fields reference data by attribute key • standard attributes are resolved first • extendedfields enables user-defined data expansion • layout does not directly contain display value
Develop Galaxy Watch for Tizen
doccreate your first tizen wearable web widget application welcome to tizen wearable web widget application development! note widget template is not supported since tizen studio 3 0 a wearable web application is basically a web site stored on a wearable device you can create it using web-native languages, such as html5, css, and javascript a widget application is one of the tizen application types it can be shown by specific ui applications such as the home screen and lock screen that can contain widget applications figure widget application on a wearable device study the following instructions to help familiarize yourself with the tizen web application development process as well as using the tizen studio and installing the created application on the emulator or target device with the instructions, you can create and run a basic wearable web widget application a web widget , which displays some text on the screen with no user interaction before you get started with developing tizen applications, download and install the tizen studio for more information on the installation process, see the installation guide create a wearable web widget project using the tizen studio this step shows how you can use a predesigned project template that creates all the basic files and folders required for your project build the application after you have implemented code for the features you want, this step shows how you can build the application to validate and compile the code run the application this step shows how you can run the application on the emulator or a real target device design a ui this step shows how you can create the application ui and make small alterations to it to improve the usability of your application when you are developing a more complex application, you can take advantage of the web tools included in the tizen studio to ease the tasks of creating functionality and designing the application ui creating a project the following example shows you how to create and configure a basic wearable web widget application project in the tizen studio an application project contains all the files that make up an application note standalone widget application packages are not allowed in the tizen store for user convenience, you can use a standalone widget application for testing purposes in the tizen studio if you want to publish the application in the tizen store, combine it with at least 1 ui application in the same package for more information, see developing multiple projects as a combined package the following figure illustrates the application to be created the application screen displays the hello widget text and no user interaction is provided figure wearable web widget application to create the application project launch the tizen studio in the tizen studio menu, select file > new > tizen project the project wizard opens in the project wizard, define the project details the project wizard is used to create the basic application skeleton with the required folder structure and mandatory files you can easily create different applications by selecting an applicable template or sample for the project wizard to use select the template project type and click next select the profile wearable and version from a drop-down list and click next the version depends on the platform version you have installed and with which you are developing the application select the web application application type and click next select the widget template and click next define the project properties and click finish you can enter the project name 3-50 characters and the unique package id you can also select the location and working sets by clicking more properties the project wizard sets up the project, creates the application files using the default content from the template, and closes for more information on the project wizard and the available templates, see creating tizen projects with tizen project wizard you can see the created project in the project explorer view the most important files and folders include css folder for css files used by the application to style its content js folder for javascript files used by the application to implement its functional logic config xml application configuration file used by the platform to install and launch the application icon png application icon file used by the platform to represent the widget index html main html file for the layout of the application screen preview png preview of the widget application file that is displayed in the widget view on the target figure application in the project explorer note you can validate your widget and view and modify the application configuration in the web application configuration editor in this example, no configuration changes are required your application project is now ready for further actions next, build the application checking the application with the api validator you can validate a tizen wearable widget application using one of 3 validators html validator css validator js validator you can enable or disable these validators in the application preferences go to window > preferences > tizen studio > webwidget, and check the applicable check boxes figure validation preferences the validation is performed automatically when the project or package is built, or when the application is run when the validation is complete, its results are shown in the problems view if the view is not displayed, select it from window > show view > problems keyboard shortcut shift + alt + q + x figure validation results managing the application configuration to view and modify the application configuration in the project explorer view, double-click the config xml file of the application the tizen studio opens the file in the web application configuration editor in the configuration editor, view and modify the configuration details using the various tabs overview define general information, such as the name and icon of the application features define required software and hardware features this information is used for application filtering in the tizen store privileges define the security-sensitive apis or api groups accessed and used by the application localization define localized values for the application name, description, and license policy request network resource permissions to access external network resources preferences define name-value pairs that can be set or retrieved through the application tizen edit the tizen schema extension properties of the application source view and edit the source code of the config xml file changes made and saved on the other tabs are reflected in the source code and vice versa note the config xml file must conform to both the xml file format and the w3c specification requirements editing the file in the source tab is intended for advanced users only to save any changes, in the tizen studio menu, select file > save all for more information on configuring the application, see setting the web application configuration understanding the source code pay attention to the following main issues in the application source code, to understand how the application is designed and how it works for source code details related to the ui, see designing a simple ui the widget application settings are defined in the config xml file the file includes various information for the widget application the following code shows an example of the widget content in the file the <tizen app-widget> element indicates the widget settings the widget application is started and initialized with the index html file the <content> field src attribute defines the starting point if the widget requires privileges, add them to the config xml file as well <?xml version="1 0" encoding="utf-8"?> <widget xmlns tizen="http //tizen org/ns/widgets" xmlns="http //www w3 org/ns/widgets" id="http //yourdomain/widget" version="1 0 0"> <tizen app-widget id="0lvphbx9t6 widget widget" primary="true"> <tizen widget-label>hello web widget!</tizen widget-label> <tizen widget-content src="widget/widget/index html"> <tizen widget-size preview="widget/widget/preview png">2x2</tizen widget-size> </tizen widget-content> </tizen app-widget> <tizen application id="0lvphbx9t6 widget" package="0lvphbx9t6" required_version="4 0"/> <content src="index html"/> <feature name="http //tizen org/feature/screen size normal"/> <icon src="icon png"/> <name>widget</name> <tizen profile name="wearable"/> </widget> the widget application consists of the following folder architecture widget widget css style css js main js index html preview png config xml icon png index html you can customize the widget/widget/index html, widget/widget/css/style css, and widget/widget/js/main js files you can add various features such as asynchronous functions, js library, and effects to the widget application using js for example, if a js-based animation effect is needed, add the requestanimationframe method or some other animation library to the js file similarly, to change the ui elements' visual looks or add css-based effects including animation , modify the css file you can define the widget as a standalone or combined web application + web widget application the widget application can be a standalone application, which means that it does not connect to a web application, or it can be combined in the same package with a web ui application however, you cannot publish a standalone widget in the tizen store when you create a widget application in the tizen studio, it is always first a standalone application if you want to connect to a web ui application, you can package the widget with a web ui application create a web ui application and the widget application in the project explorer view, right-click the web application, and select properties > tizen studio > package > multi, and select the widget to be included in the package click ok in the following figure, the widget widget application is packaged with the app ui application the widget widget application indicates this with the [with app] text building your application after you have created the application project, you can implement the required features in this example, only the default features from the project template are used, and no code changes are required when your application code is ready, you must build the application the building process performs a validation check and compiles your javascript and css files you can build the application in the following ways automatically the automatic build means that the tizen studio automatically rebuilds the application whenever you change a source or resource file and save the application project to use the automatic build select the project in the project explorer view in the tizen studio menu, select project > build automatically a check mark appears next to the menu option you can toggle the automatic build on and off by reselecting project > build automatically manually the manual build means that you determine yourself when the application is built to manually build the application, right-click the project in the project explorer view and select build project figure manually building the application alternatively, you can also select the project in the project explorer view and do one of the following in the tizen studio menu, select project > build project press the f10 key after you have built the application, run it running your application you can run the web widget application on the emulator or a real target device note since the web simulator does not support a circular ui, this topic does not cover the instructions for running the application on the web simulator running on the emulator to run the application on the emulator launch an emulator instance in the emulator manager in the tizen studio menu, select tools > emulator manager in the emulator manager, select a wearable emulator from the list and click launch if no applicable emulator instance exists, create a new one the emulator is launched in its own window you can also see the new emulator instance and its folder structure in the device manager generate a security profile before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the project explorer view, right-click the project and select run as > tizen web application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have created multiple emulator instances, select the instance you want from the combo box in the toolbar before selecting to run the application if you select an offline emulator, it is automatically launched when you select to run the application confirm that the application launches on the emulator note if the emulator display has switched off, you cannot see the application launch to switch the display on, click the power key in the lower-right corner of the emulator the above screen is shown through the viewer, to allow you to develop a lone widget application for testing purposes to see the widget running on the home screen, add the widget there 1 press the **back** key in the upper-right corner of the emulator device to return to the home screen showing a watch face 2 swipe the home screen right until you see **+ add widget** select it 3 swipe right until you see your widget application select it ![adding to home screen] https //docs tizen org/application/web/get-started/wearable-widget/media/widget_run_add_home_ww png you can see the added widget on the home screen to access the widget from the home screen, swipe right ![home screen widget] https //docs tizen org/application/web/get-started/wearable-widget/media/widget_app_wearable_widget png while the application is running, the **log** view in the tizen studio shows the log, debug, and exception messages from the methods defined in the log macros to see the view, in the tizen studio menu, go to **window \> show view \> log** for more information on using the emulator features, see using emulator control keys, menu, and panel and using extended emulator features running on a target device to run the application on a target device connect the wearable target device to your computer define settings on the device go to settings > connections, and switch on wi-fi the device and the computer must be connected to the same wi-fi network note the ip address the device is using go to settings > gear info, and switch on the debugging mode in the terminal, enter the following commands cd tizen-studio/tools /sdb connect <ip address of galaxy watch> use the ip address you noted before instead of the terminal, you can also use the remote device manager for the connection in the first attempt, the connection fails and the device asks for user confirmation to allow galaxy watch to read log data, copy files to and from your computer, and install the application manually, click the accept mark in the device manager, confirm that the device is connected shown in the device list generate an author certificate before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the device manager, select the device in project explorer view, right-click the project and select run as > tizen web application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have both a connected device and existing emulator instances, select the device from the combo box in the toolbar before selecting to run the application confirm that the application launches on the target device like with the emulator, you can add the widget to the home screen to easily access it note the application is launched using the default debug run configuration to create and use another configuration in the project explorer view, right-click the project and select run as > run configurations in the run configurations window, click the new launch configuration icon , define the configuration details, and launch the application by clicking run designing a simple ui the widget application created with the widget template has a simple user interface with a text component showing the hello widget text on the screen the ui is created using w3c/html in the index html file the w3c specifications provide html and css features for creating a user interface with html, you can define the structure of the application screens, while css allows you to define the look and feel of the screens figure user interface in the widget template creating the basic ui the ui in the widget template uses the html dom, which is a structured model to control web elements it is an official w3c standard to express the document regardless of platforms or languages, and the foundation of the html5 apis the template contains the following components the <html> element is the top-level element of the html dom tree that wraps the entire document, and it has the <head> and <body> elements as child nodes <!doctype html> <html> <head> <!--content--> </head> <body> <!--content--> </body> </html> the <head> element contains the information that the browser refers to when rendering the body element to interpret information, such as the title of the html document, and the location of the related css and javascript files <meta> defines information, such as encoding, creator, and keywords of the document <style>, <link> sets the styles of the document <script>, <noscript> adds functions to the document <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style css"/> <script src="js/main js"></script> <style></style> </head> the <body> element defines the area displaying content on the browser screen in this case, it defines the hello widget text component <body> <div id="page"> <div id="container"> <p id="content-text">hello widget</p> </div> </div> </body> modifying existing components with css css cascading style sheets specifies the layout and styling of the web application there are various ways to connect css with html style attribute in an html element <link> element in the <head> element @import attribute in the css area <style> element in the <head> element applying the style of an html element directly with the style attribute has the highest priority on the other hand, creating a separate css file and managing it separately is convenient when it comes to applying changes in the future in the widget template, the css file is connected to the html file using a <link> element in the <head> element <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style css"/> <script src="js/main js"></script> <style></style> </head> the following lines in the css code describe the styling of the text in an element with the content-text id css/style css html, body { width 100%; height 100%; margin 0; padding 0; } #page { background-color #000; color #fff; height 100%; position relative; width 100%; } #container { width 100%; height 100%; } #content-text { font-weight bold; font-size 40px; width 100%; height 100%; line-height 360px; margin 0; text-align center; } index html <body> <div id="page"> <div id="container"> <p id="content-text">hello widget</p> </div> </div> </body> by default, the text uses the #fff color white , defined for the <div> element with the page id if you change the css code and add a separate color for the content-text id, the text color changes in this case, to #ff0000 red #content-text { font-weight bold; font-size 40px; width 100%; height 100%; line-height 360px; margin 0; text-align center; color #ff0000; } figure screen with a new text color
tutorials mobile
bloggalaxy store provides a platform where developers can sell their apps to galaxy device users. samsung in-app purchase (iap) is a payment service which allows you to sell your app's in-app items that are distributed through galaxy store. if you want to make any changes to your app's in-app items, then you have to update your app using galaxy store seller portal. however, if you want the changes to be reflected immediately within the content, even when the content is in the for sale state, then the galaxy store developer api is the solution for you. the galaxy store developer api provides programmatic access to the same types of functionality provided by the galaxy store seller portal. the iap publish api is a part of the galaxy store developer api, a set of server-to-server apis that allows you to manage in-app items. this api is used to view, register, modify, and remove samsung iap items. you can find the curl commands for this api in the iap publish api guide. in this blog article, i am going to demonstrate how to implement the iap publish api using python. let's get started! get started in this example, you should already know about the in-app purchase sdk and how to create items in seller portal. to learn how to sell in-app items through galaxy store, please read the in-app purchase programming guide. the iap publish api supports crud operations for in-app items: create, read, update, and delete. the available http methods for these operations are post, get, put, patch, and delete, respectively. later, i explain which http method is used for which iap publish api. since i implement this api in python, i need to install python on my pc. the rest of this blog assumes you have already done this. prerequisites: seller account: create a seller account in galaxy store seller portal using the galaxy store seller portal user guide. service account id: get the service account id from seller portal. you can find the details here. authorization: get the access token from the galaxy store authentication server using the accesstoken api. check out this blog to learn about creating an access token using python. iap sdk integrated app: the iap sdk must be integrated into the app. all binaries registered in the content must support iap. connection with the content of the in-app purchase tab area of seller portal: to create this connection, you must either initially distribute your content using the content publish api or the content must be in the for sale state in seller portal. the following headers are required to call any api, just like any other galaxy store developer api. attribute type description content-type string application/json authorization string bearer <your-access-token> service-account-id header your service account id the iap publish api provides a total of six apis to manage in-app items. after fulfilling the above requirements, i am ready to implement these apis in python. view item list i can view the list of item information within a scope. while sending this request, i have to specify the number of pages of content to return and the number of items to be returned for a page. since this is a rest api, i have to make an http request. to make an http request to a specified url, i need the requests library. so, first i have to import the library in our script. i also import the json library to see the response in json format. # importing the requests library import requests # importing the json library import json as mentioned earlier, i need to send some data as the header in the request. first i set these values before creating the header. then i create a dictionary using the syntax {key: value}. here, the key is the attribute name and the value is the header content. access_token = "<access_token>" authorization = "bearer " + access_token service_account_id = "<your-service-account-id>" # header to be sent to the api headers= { 'authorization': authorization, 'content-type': 'application/json', 'service-account-id': service_account_id } the get method is used to read or retrieve data from the given server using a given url. it doesn't change any data. therefore, i use an http get request for this api. in the get request, the package name of an app, the number of pages, and the number of items are required. as an example, i set the number of pages as 1 and the number of items as 20. packagename = "<package-name-of-your-app>" page = '1' size = '20' now, i define the url and send the get request. # defining the api endpoint item_list = 'https://devapi.samsungapps.com/iap/v6/applications/' + packagename + '/items?page=' + page + '&size=' + size payload={} try: response = requests.get(item_list, headers=headers,data=payload) print(response.status_code) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) figure 1: response of the view item list api view individual item i use this api to view the detailed information of one item. the item id is a required parameter for this api, being a unique identifier of an in-app item registered in seller portal. the python script for this api is similar to the view item list api; i just need to change the request url. itemname = '<item-id-of-specific-package-id>' # defining the api endpoint individual_item = 'https://devapi.samsungapps.com/iap/v6/applications/' + packagename + '/items/' + itemname try: response = requests.get(individual_item, headers=headers,data=payload) print(response.status_code) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) figure 2: response of the view individual item api create item this api allows you to create a new item, which can be either consumable or non-consumable. to learn more about the item types, visit the iap programming guide. to register an item, you are required to set nine parameters as the data in an http post request. the post method is used for creating a new resource. first, let's go through an example where i create a new item called 'one_gallon_gas'. i set a title of this item and a description which explains the purpose of this item. to be able to purchase the item multiple times, i set its type as consumable. i set the 'phonebillstatus' attribute as 'true' so that the user can pay by an automatic payment on their phone bill. i set the item status as 'published' to list it for sale in galaxy store. finally, i set the usd price, local price, country id, and currency values. next, i create a dictionary to hold the data which is sent to the api. i need to send serialized data in a form of a string and thus json.dumps is necessary to perform the serialization. # data to be sent payload = json.dumps({ "id": "one_gallon_gas", "description": "fuel for driving game", "status": "published", "type": "consumable", "usdprice": 0.99, "title": " 1 gallon gas", "prices": [ { "countryid": "nga", "currency": "ngn", "localprice": "400.000" }, { "countryid": "per", "currency": "pen", "localprice": "3.900" }, { "countryid": "swe", "currency": "sek", "localprice": "11.000" } ] }) finally, i define the url and send the post request. new_item = "https://devapi.samsungapps.com/iap/v6/applications/" + packagename + "/items" try: response = requests.post(new_item, headers=headers,data=payload) print(response.status_code) #print(response.text) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) modify item this api allows you to modify an in-app item without updating the app. the item id can't be changed using this api. it is recommended to use the response from the view individual item api to create the input required for this request. in this example, i modify the title and description of an item which i created in the previous section. i also modify the usd price, local price, country id, and currency values. i create a dictionary to hold the data which is sent to the api, as was done in the previous section. # data to be sent payload = json.dumps({ "id": "one_gallon_gas", "title": "3 gallon gas", "description": "modify fuel for driving game fix", "type": "consumable", "status": "published", "itempaymentmethod": { "phonebillstatus": true }, "usdprice": 1, "prices": [ { "countryid": "kor", "currency": "krw", "localprice": "900" }, { "countryid": "usa", "currency": "usd", "localprice": "1" } ] }) since this request is for modification, i send it using a put request, which is a method for updating the entire resource. so, i define the url and send the http request. # defining the api endpoint modify_item = "https://devapi.samsungapps.com/iap/v6/applications/" + packagename + "/items" try: response = requests.put(modify_item, headers=headers,data=payload) print(response.status_code) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) partial item modification this api is used to modify the title, countryid, or localprice of an in-app item. i can't change the item id using this api. this api only does a partial update unlike the modify item api, so an http patch request is used. the patch request requires only those fields which are to be modified. it doesn't change the other fields of the resource, in contrast to the put request which changes the entire resource. in this example, i modify only the title of the 'one_gallon_gas' item. the python script remains the same as in the previous section. # data to be sent to the api payload = json.dumps({ "id": "one_gallon_gas ", "title": "5 gallon gas" }) # defining the api endpoint partial_modify_item = "https://devapi.samsungapps.com/iap/v6/applications/" + packagename + "/items" try: response = requests.patch(partial_modify_item, headers=headers,data=payload) print(response.status_code) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) remove item this api allows us to remove an in-app item. here, the item id is the required field in the request url. i add the item id in the request url and send the http delete request. the delete method is used to request the server to delete a resource specified by the given url. itemname = "one_gallon_gas" # defining the api endpoint remove_item = "https://devapi.samsungapps.com/iap/v6/applications/" + packagename + "/items/" + itemname payload = {} try: response = requests.delete(remove_item, headers=headers,data=payload) print(response.status_code) pretty_json = json.loads(response.text) print (json.dumps(pretty_json, indent=2)) except exception as e: print(str(e)) figure 3: response of the remove item api conclusion other than selling paid apps, in-app purchases are the most common and popular way to monetize an app. you can integrate the samsung in-app sdk in your app to generate profit and use the iap publish api to automate item-related tasks. this is the last blog article of this series. i hope you've found this article helpful. you can check out the other blogs about the galaxy store developer api below. blog articles in this series how to create an access token for the galaxy store developer api using python: learn how to create an access token using the galaxy store developer api and python. how to get statistics: galaxy store statistics (gss) is a tool that provides information about your sales, revenue, ratings, and much more, which helps you to make more effective business decisions. you can learn how to get statistical data from your apps using python. how to manage content: manage your content in galaxy store by using the content publish api. in an app production system, managing content is a frequent task. this blog covers the implementation of this api using python to automate your app distribution system.
Jakia Sultana
Develop Smart TV
docsamsung checkout this topic describes how you can develop a billing system for your application, to allow users to make purchases within your application related info billing api productinfo api sso api samsung checkout dpi portal guide samsung checkout for tizen net samsung checkout dpi portal samsung checkout on tv samples samsung checkout web application samsung checkout net application samsung checkout offers an optimized purchase experience for your users on samsung tvs the user can quickly and safely register a payment method and make frictionless payments repeatedly within the tv environment in addition, samsung checkout provides a comprehensive global monetization platform, which allows you to integrate various business models and promotional campaigns into your services the tv-optimized purchase experience provides the user a quick and simple 3-step checkout, once a payment method is registered the checkout requires only number-centric information to be entered, making it easy to use with a tv remote control users can register their payment method directly on the tv or through a mobile phone to use samsung checkout, the user needs tv samsung smart tv, 2016 or later model supporting tizen excluding evolution kit payment method credit or debit card, paypal, or samsung pay in korea, united states security tizen secureime, 2nd-screen card registration mobile or pc account samsung account for sharing account and payment information with galaxy phones importanta samsung account is mandatory for using samsung checkout samsung checkout assumes that the user is logged in to samsung account at all times samsung checkout provides one solution for payment execution ✔ one solution supports all functions from payment operation ✔ operate automatically settlement and payout strong security payment solution ✔ acquire pci-dss certification and follow regulation each of countries psd2 ✔ following psd2 regulantion and gdpr deliver the coupon/promotional code in various ways of distribution with easiest ux ✔ issue coupons for promotion provide dpi digital product inventory system ✔ create and manage service items ✔ check the status of sales amounts and transaction scale ✔ refund and cancel subscription you can manage your product application and product sales through the dpi digital product inventory and process the actual purchase through samsung checkout importantall application data that is saved locally on a tv is deleted when the application is deleted from that tv if the user's purchase history is saved only in the tv storage and not remotely, and the user deletes and reinstalls the application, all application settings and content are removed, including purchased content if your application saves purchase information in the tv storage only, inform the user that uninstalling the application deletes their purchased content the dpi portal provides functions, such as "purchase history unapply" and "refund", to help you address situations when your customer inadvertently deletes application data before proceeding with the unapply and refund processes, you must contact a samsung representative by going to "samsung apps tv seller office > support" and creating a "1 1 q&a" support ticket samsung checkout purchase process when a user wants to purchase a product on your application, samsung checkout provides a common purchase gui, which identifies the user and confirms first the purchase and then the purchase completion after the user completes the purchase, samsung checkout returns the purchase result to your application product, purchase, and payment management the following figure illustrates how you can use samsung checkout and the information in the dpi server to manage in-app purchases and payments in your application request the purchase list retrieve the customer purchase list using a purchase list api request respond to the purchase list content if there are products in the purchase list which are not applied, verify the purchase and apply the products if there are products in the purchase list which have been refunded, retrieve the products send the application result to the server request the product list request the product information list using a products list api request the user purchases the product when the user selects “buy” in the application, provide a common purchase gui through samsung checkout the user can enter a voucher or coupon code to modify the purchase price the user confirms the purchase by entering a pin on the common purchase gui, or biometric information on samsung pay samsung checkout delivers the purchase result to your application request the purchase list update the customer purchase list verify the purchase verify the purchase using a verify purchase api request apply the product apply the product using an apply product api request, and send the application result to the server payment flow with dynamic products if a partner already has a cms server which manages products and prices, and frequent changes to product information are required, the partner and samsung can discuss the use of dynamic products when they integrate samsung checkout if they agree on that products and prices will be managed by the partner's own cms instead of samsung’s dpi, the partner needs to register a representative item on the dpi so that the samsung checkout system can display legally-required information on samsung smart tv app/game store however, the partner does not need to register each product on the dpi that they sell in their application they should build and operate their own cms to manage product information, including prices, and provide the rest of the api for verification of purchase requests the following figure shows the data flow of the initialization stage in a payment process with dynamic products additional dpi requirements as this model requires the partner's cms to manage product information, there are additional requirements that partner need to fulfill for dpi settings verification/no verification ‘verification’ is a recommended option, otherwise the partner has to handle the verification process themselves and accept the responsibility for all error cases related to the verification process if the ‘verification’ option is selected, ‘verify uri’ is also required this uri needs serve the function of checking product information such as the product itself, price, and currency during the initialization sequence of the payment process price setting the price range information of products that you actually sell in your application is required by country this information is not used for actual payment, but for providing legally-required application information on the samsung smart tv app/game store which therefore, it has to be updated when the price range of your products is changed differences when using dynamic products during buyitem , when using dynamic products the partner needs to set the following values in order to complete the payment process "orderitemid" - representative productid that is registered to dpi portal as a dynamic product type "ordertitle" - customized name for each purchase displayed as in figure 7 "ordertotal" - customized price for each purchase displayed as in figure 7 "dynmcproductid" - unique product id managed by the partner cms in addition, during verify product, the partner needs to strictly verify the following values in order to identify if the product information is appropriate "appid" - the application has to be appropriate for this payment process "productid" - the product id has to match the representative productid from the dpi portal "productprice" - the price of the product that partner intended to sell to user "dynmcproductid" - the product id is an appropriate id that is being handled by the partner cms checkout service county/location list no area country eng business model 1 north america canada agent 2 north america united states commissionaire 3 europe aland islands commissionaire 4 europe albania agent 5 europe austria commissionaire 6 europe belgium commissionaire 7 europe bosnia and herzegovina agent 8 europe bulgaria commissionaire 9 europe croatia commissionaire 10 europe cyprus commissionaire 11 europe czech republic commissionaire 12 europe denmark commissionaire 13 europe estonia commissionaire 14 europe faroe islands commissionaire 15 europe finland commissionaire 16 europe france commissionaire 17 europe germany commissionaire 18 europe greece commissionaire 19 europe greenland commissionaire 20 europe guernsey commissionaire 21 europe hungary commissionaire 22 europe iceland agent 23 europe ireland commissionaire 24 europe isle of man commissionaire 25 europe italy commissionaire 26 europe jersey commissionaire 27 europe latvia commissionaire 28 europe lithuania commissionaire 29 europe luxembourg commissionaire 30 europe montenegro agent 31 europe netherlands commissionaire 32 europe north macedonia agent 33 europe norway commissionaire 34 europe poland commissionaire 35 europe portugal commissionaire 36 europe romania commissionaire 37 europe serbia agent 38 europe slovakia commissionaire 39 europe slovenia commissionaire 40 europe spain commissionaire 41 europe sweden commissionaire 42 europe switzerland agent 43 europe united kingdom commissionaire 44 asia australia agent 45 asia hong kong agent 46 asia india agent 47 asia indonesia agent 48 asia korea, republic of agent 49 asia malaysia agent 50 asia new zealand agent 51 asia philippines agent 52 asia singapore agent 53 asia taiwan agent 54 asia thailand agent 55 asia vietnam agent 56 cis belarus agent 57 cis kazakhstan agent 58 cis kyrgyzstan agent 59 cis moldova agent 60 cis mongolia agent 61 cis russian federation agent 62 cis tajikistan agent 63 cis turkmenistan agent 64 cis ukraine agent 65 cis uzbekistan agent 66 latam argentina agent 67 latam bolivia agent 68 latam brazil agent 69 latam chile agent 70 latam colombia agent 71 latam costa rica agent 72 latam dominican republic agent 73 latam ecuador agent 74 latam guatemala agent 75 latam mexico agent 76 latam panama agent 77 latam peru agent 78 latam venezuela agent 79 mena algeria agent 80 mena bahrain agent 81 mena egypt agent 82 mena ghana agent 83 mena iraq agent 84 mena israel agent 85 mena jordan agent 86 mena kenya agent 87 mena kuwait agent 88 mena lebanon agent 89 mena libya agent 90 mena mauritius agent 91 mena morocco agent 92 mena nigeria agent 93 mena oman agent 94 mena pakistan agent 95 mena qatar agent 96 mena saudi arabia agent 97 mena south africa agent 98 mena tunisia agent 99 mena türkiye agent 100 mena united arab emirates agent 101 mena yemen agent 102 latam paraguay agent 103 latam uruguay agent 104 latam el salvador agent 105 latam honduras agent 106 latam nicaragua agent 107 latam bahamas agent 108 latam jamaica agent 109 latam trinidad & tobago agent 110 asia cambodia agent 111 asia myanmar agent 112 asia laos agent 113 asia macao agent 114 asia bangladesh agent 115 asia nepal agent 116 asia sri lanka agent 117 cis armenia agent 118 cis azerbaijan agent 119 cis georgia agent 120 europe liechtenstein agent table 1 samsung checkout service countries
Develop Galaxy Watch for Tizen
doccreate your first tizen wearable native widget application welcome to tizen wearable native widget application development! a wearable native widget application is created using the c language, and can be run on tizen wearable devices the application uses the native api, which provides various interfaces to the device hardware allowing you to take advantage of numerous capabilities tailored to run with limited device resources a widget application is one of the tizen application types it can be shown by specific ui applications such as the home screen and lock screen that can contain widget applications figure widget application on a wearable device study the following instructions to help familiarize yourself with the tizen native application development process as well as using the tizen studio and installing the created application on the emulator or target device with the instructions, you can create and run a basic wearable native widget application, which displays some text on the screen with no user interaction before you get started with developing tizen applications, download and install the tizen studio for more information on the installation process, see the installation guide create a wearable native widget project using the tizen studio this step shows how you can use a predesigned project template that creates all the basic files and folders required for your project build the application after you have implemented code for the features you want, this step shows how you can build the application to validate and compile the code run the application this step shows how you can run the application on the emulator or a real target device design a ui this step shows how you can create the application ui and make small alterations to it to improve the usability of your application when you are developing a more complex application, you can take advantage of the native tools included in the tizen studio to ease the tasks of creating functionality and designing the application ui creating a project the following example shows you how to create and configure a basic wearable native widget application project in the tizen studio an application project contains all the files that make up an application note standalone widget application packages are not allowed in the tizen store for user convenience, you can use a standalone widget application for testing purposes in the tizen studio if you want to publish the application in the tizen store, combine it with at least 1 ui application in the same package for more information, see developing multiple projects as a combined package the following figure illustrates the application to be created the application screen displays the hello widget text and no user interaction is provided figure wearable native widget application to create the application project launch the tizen studio in the tizen studio menu, select file > new > tizen project the project wizard opens in the project wizard, define the project details the project wizard is used to create the basic application skeleton with the required folder structure and mandatory files you can easily create different applications by selecting an applicable template or sample for the project wizard to use select the template project type and click next select the profile wearable and version from a drop-down list and click next the version depends on the platform version you have installed and with which you are developing the application select the native application application type and click next select the widget template and click next define the project properties and click finish you can enter the project name 3-50 characters and the unique package id you can also select the location and working sets by clicking more properties the project wizard sets up the project, creates the application files using the default content from the template, and closes for more information on the project wizard and the available templates, see creating tizen projects with tizen project wizard you can see the created project in the project explorer view the most important files and folders include inc default folder for included source files res folder for resource files used by the application only shared folder for resource files to be shared with other applications src folder for source code files lib folder for external library files tizen-manifest xml manifest file used by the platform to install and launch the application figure application in the project explorer note you can view and modify the application configuration in the manifest editor in this example, no configuration changes are required your application project is now ready for further actions next, build the application managing the application configuration to view and modify the application configuration in the project explorer view, double-click the tizen-manifest xml file of the application the tizen studio opens the file in the manifest editor in the manifest editor, view and modify the configuration details using the various tabs overview define general information, such as the package, label, and icon of the application features define required software and hardware features this information is used for application filtering in the tizen store privileges define the security-sensitive apis or api groups accessed and used by the application localization define localized values for the application label, description, and icon advanced define advanced features, such as application metadata, widget preview image and supported size , and miscellaneous options source view and edit the source code of the tizen-manifest xml file changes made and saved on the other tabs are reflected in the source code and vice versa note the tizen-manifest xml file must conform to both the xml file format and the tizen native application specification requirements editing the file in the source tab is intended for advanced users only to save any changes, in the tizen studio menu, select file > save all for more information on configuring the application, see setting the application manifest understanding the source code pay attention to the following main issues in the application source code in the inc/widget h and src/widget c files , to understand how the application is designed and how it works for source code details related to the ui, see designing a simple ui the widget application is initialized to use the functions and data types of the widget application api by including the <widget_app h> header file in your application #include <widget_app h> all header files that you need are already included in the widget h file, which is generated by the tizen studio when the template project is created the widget application life-cycle callbacks manage specific parts of the application life-cycle they are set in the widget_app_lifecycle_callback_s structure, and the structure is passed to the widget_app_main function of the widget application api to start the widget application event loop int main int argc, char *argv[] { widget_app_lifecycle_callback_s ops = {0,}; int ret; ops create = widget_app_create; ops terminate = widget_app_terminate; ret = widget_app_main argc, argv, &ops, null ; if ret != widget_error_none dlog_print dlog_error, log_tag, "widget_app_main failed err = %d", ret ; return ret; } the create event is triggered before the application main loop starts in this callback, you can initialize any resources that can be shared among widget instances register the widget instance callback functions, and create a widget instance class and return a handle for it, so that the handle can be used for making widget instances static widget_class_h widget_app_create void *user_data { /* hook to take necessary actions before the main event loop starts */ widget_instance_lifecycle_callback_s ops = {null,}; return widget_app_class_create ops, user_data ; } the terminate event is triggered before the application ends when you no longer need the widget application, use it to release the resources and terminate the application static void widget_app_terminate void *user_data { /* release all resources */ } the widget application provides a life-cycle and functions for making and managing a widget class the application has one process, whose responsibility it is to make a class in the widget_app_create callback function of the widget application api with this class, the framework can make instances whenever applications for widget viewers such as home screen or lock screen request for a widget instance the widget instance has its own life-cycle, which is similar to the widget application however, the widget instance is simply an object that is shown by the applications for widget viewers many widget instances can be running on the same widget application process to manage the widget instance life-cycle, add the relevant callbacks to the widget_instance_lifecycle_callback_s structure during the widget application initialization static widget_class_h widget_app_create void *user_data { widget_instance_lifecycle_callback_s ops = { create = widget_instance_create, destroy = widget_instance_destroy, pause = widget_instance_pause, resume = widget_instance_resume, update = widget_instance_update, resize = widget_instance_resize, }; return widget_app_class_create ops, user_data ; } the create callback is triggered when the widget instance is created you can use the callback to initialize resources for the widget instance and draw the ui if the bundle content is not null, restore the previous status static int widget_instance_create widget_context_h context, bundle *content, int w, int h, void *user_data { widget_instance_data_s *wid = widget_instance_data_s* malloc sizeof widget_instance_data_s ; int ret; if content != null /* recover the previous status with the bundle object */ /* create the ui */ return widget_error_none; } the destroy callback is triggered when the widget instance is destroyed you can use the callback to release all widget resources if the reason for the termination is not widget_app_destroy_type_permanent, store the current status with the incoming bundle static int widget_instance_destroy widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data { if reason != widget_app_destroy_type_permanent /* save the current status at the bundle object */ return widget_error_none; } the pause callback is triggered when the widget instance is paused you can use the callback to take the necessary actions when the widget instance becomes invisible the framework can destroy a paused widget instance static int widget_instance_pause widget_context_h context, void *user_data { return widget_error_none; } the resume callback is triggered when the widget instance is resumed you can use the callback to take the necessary actions when the widget instance becomes visible static int widget_instance_resume widget_context_h context, void *user_data { return widget_error_none; } the update callback is triggered when a widget update event is received you can use the callback to take the necessary actions for the widget update if the force parameter is true, the widget can be updated even in the pause state static int widget_instance_update widget_context_h context, bundle *content, int force, void *user_data { return widget_error_none; } widget instances can have private data the data usually includes view objects to make a screen for each widget instance the framework provides an easy way to find private data from the widget context handle, which is provided as a parameter in the callback functions the following example shows how to make private data and use it you can define a private data structure and attach it to the widget instance by calling the widget_app_context_set_tag function of the widget application api struct widget_instance_data { evas_object *win; evas_object *conform; evas_object *label; }; typedef struct widget_instance_data widget_instance_data_s; static int widget_instance_create widget_context_h context, bundle *content, int w, int h, void *user_data { widget_instance_data_s *wid = widget_instance_data_s* malloc sizeof widget_instance_data_s ; ret = widget_app_get_elm_win context, &wid->win ; wid->label = elm_label_add wid->conform ; widget_app_context_set_tag context, wid ; } you can get the private data from the widget instance by calling the widget_app_context_get_tag function of the widget application api the following code within the widget_instance_update callback is not included in the default application template in the tizen studio, but you can add it to test the data handling feature static int widget_instance_update widget_context_h context, bundle *content, int force, void *user_data { widget_instance_data_s *wid = null; widget_app_context_get_tag context, void** &wid ; if wid->label elm_object_text_set wid->label, "update widget" ; return widget_error_none; } if you use private data, make sure that all the resources that you allocate are freed in the callback function for the widget instance destructor static int widget_instance_destroy widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data { widget_instance_data_s *wid = null; widget_app_context_get_tag context, void** &wid ; if wid->win evas_object_del wid->win ; free wid ; return widget_error_none; } building your application after you have created the application project, you can implement the required features in this example, only the default features from the project template are used, and no code changes are required when your application code is ready, you must build the application the building process performs a validation check and compiles your files you can build the application in the following ways automatically the automatic build means that the tizen studio automatically rebuilds the application whenever you change a source or resource file and save the application project to use the automatic build select the project in the project explorer view in the tizen studio menu, select project > build automatically a check mark appears next to the menu option you can toggle the automatic build on and off by reselecting project > build automatically manually the manual build means that you determine yourself when the application is built to manually build the application, right-click the project in the project explorer view and select build project figure manually building the application alternatively, you can also select the project in the project explorer view and do one of the following in the tizen studio menu, select project > build project press the f10 key you can have more than one build configuration to see the current active configuration or change it, right-click the project in the project explorer view and select build configurations > set active the default configuration is debug for more information, see building applications after you have built the application, run it running your application you can run the application on the emulator or a real target device running on the emulator to run the application on the emulator launch an emulator instance in the emulator manager in the tizen studio menu, select tools > emulator manager in the emulator manager, select a wearable emulator from the list and click launch if no applicable emulator instance exists, create a new one the emulator is launched in its own window you can also see the new emulator instance and its folder structure in the device manager generate a security profile before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have created multiple emulator instances, select the instance you want from the combo box in the toolbar before selecting to run the application if you select an offline emulator, it is automatically launched when you select to run the application confirm that the application launches on the emulator note if the emulator display has switched off, you cannot see the application launch to switch the display on, click the power key in the lower-right corner of the emulator the above screen is shown through the viewer, to allow you to develop a lone widget application for testing purposes <a name="viewer"></a> to see the widget running on the home screen, add the widget there 1 press the **back** key in the upper-right corner of the emulator device to return to the home screen showing a watch face 2 swipe the home screen right until you see **+ add widget** select it 3 swipe right until you see your widget application select it ![adding to home screen] https //docs tizen org/application/native/get-started/wearable-widget/media/widget_run_add_home_wn png you can see the added widget on the home screen to access the widget from the home screen, swipe right ![home screen widget] https //docs tizen org/application/native/get-started/wearable-widget/media/emulator_running_wn_widget png while the application is running, the **log** view in the tizen studio shows the log, debug, and exception messages from the methods defined in the log macros to see the view, in the tizen studio menu, go to **window \> show view \> log** for more information on using the emulator features, see using emulator control keys, menu, and panel and using extended emulator features running on a target device to run the application on a target device connect the wearable target device to your computer define settings on the device go to settings > connections, and switch on wi-fi the device and the computer must be connected to the same wi-fi network note the ip address the device is using go to settings > gear info, and switch on the debugging mode in the terminal, enter the following commands cd tizen-studio/tools /sdb connect <ip address of galaxy watch> use the ip address you noted before instead of the terminal, you can also use the remote device manager for the connection in the first attempt, the connection fails and the device asks for user confirmation to allow galaxy watch to read log data, copy files to and from your computer, and install the application manually, click the accept mark in the device manager, confirm that the device is connected shown in the device list generate an author certificate before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the device manager, select the device in project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have both a connected device and existing emulator instances, select the device from the combo box in the toolbar before selecting to run the application confirm that the application launches on the target device like with the emulator, you can add the widget to the home screen to easily access it note the application is launched using the default debug run configuration to create and use another configuration in the project explorer view, right-click the project and select run as > run configurations in the run configurations window, click the new launch configuration icon , define the configuration details, and launch the application by clicking run designing a simple ui the wearable widget application created with the widget template has a simple user interface with a label component showing the hello widget text the ui is created using efl figure user interface in the widget template creating the basic ui the ui in the widget template contains the following components the efl ui always contains a window component, which is the root component of the entire ui the application uses the conformant component as a container for other ui components the label showing the hello widget text is implemented with a label component the ui is created in the widget c file data structure a pointer to the ui components is stored in the widget_instance_data_s data structure #include <widget_app_efl h> struct widget_instance_data { /* window */ evas_object *win; /* conformant */ evas_object *conform; /* label */ evas_object *label; }; typedef struct widget_instance_data widget_instance_data_s; ui creation the widget_app_create life-cycle callback is called when the application main loop starts it registers the widget_instance_create callback, which creates the ui when the widget instance starts static widget_class_h widget_app_create void *user_data { /* register system event handlers */ widget_instance_lifecycle_callback_s ops = { create = widget_instance_create, destroy = widget_instance_destroy, pause = widget_instance_pause, resume = widget_instance_resume, update = widget_instance_update, }; return widget_app_class_create ops, user_data ; } ui components the widget_instance_create function creates the ui components window, conformant, and label the function defines a pointer to fill in the widget_instance_data_s structure static int widget_instance_create widget_context_h context, bundle *content, int w, int h, void *user_data { widget_instance_data_s *wid = widget_instance_data_s* malloc sizeof widget_instance_data_s ; int ret; if content != null /* recover the previous status with the bundle object */ the window object for the widget is retrieved with the widget_app_get_elm_win function of the widget application api to create the ui on the home screen the evas_object_resize function is used to resize the window to fit the screen /* window */ ret = widget_app_get_elm_win context, &wid->win ; if ret != widget_error_none { dlog_print dlog_error, log_tag, "failed to get window err = %d", ret ; return widget_error_fault; } evas_object_resize wid->win, w, h ; the conformant component is used as a container for the other ui components the component is the first object added inside the window with the elm_conformant_add function the conformant component is set as a resize object of the window by using the elm_win_resize_object_add function it means that the conformant size and position are controlled by the window component directly the evas_object_show function makes the conformant component visible /* conformant */ wid->conform = elm_conformant_add wid->win ; evas_object_size_hint_weight_set wid->conform, evas_hint_expand, evas_hint_expand ; elm_win_resize_object_add wid->win, wid->conform ; evas_object_show wid->conform ; the label component for the text is added with the elm_label_add function the label is added inside the conformant component, which is the label's parent the label is resized and moved, and its text is set with the elm_object_text_set function /* label */ wid->label = elm_label_add wid->conform ; evas_object_resize wid->label, w, h / 3 ; evas_object_move wid->label, w / 4, h / 3 ; evas_object_show wid->label ; elm_object_text_set wid->label, "<align=center>hello widget</align>" ; when all the ui components are ready, the evas_object_show function makes the window component visible this means that the window displays everything on the screen at once /* show the window after the base gui is set up */ evas_object_show wid->win ; widget_app_context_set_tag context, wid ; return widget_error_none; } modifying existing components when the basic ui exists, you can easily modify the components in the ui by using the component-specific functions, or more general evas object functions for example, the following modification to the label component changes the text color to green /* label */ wid->label = elm_label_add wid->conform ; evas_object_resize wid->label, w, h / 3 ; evas_object_move wid->label, w / 4, h / 3 ; evas_object_color_set wid->label, 50, 255, 150, 255 ; evas_object_show wid->label ; elm_object_text_set wid->label, "<align=center>hello widget</align>" ; figure modified label component
Develop Galaxy Watch for Tizen
doccreate your first tizen wearable native watch application welcome to tizen wearable native watch application development! note for watch face developers you can create watch faces with galaxy watch studio or tizen studio for your personal enjoyment however you will not be able to add watch face applications to seller portal until you have received approval to publish watch faces the review is not required for watch app and widget developers galaxy store supports watch faces for galaxy watch3 and earlier samsung watches running on tizen watch faces for galaxy watch4 and later running on wear os powered by samsung is only supported in the chinese galaxy store a wearable native watch application is created using the c language, and can be run on tizen wearable devices to display a customized watch face to the user study the following instructions to help familiarize yourself with the tizen native application development process as well as using the tizen studio and installing the created application on the emulator or target device with the instructions, you can create and run a basic wearable native watch application, which displays some text and the current time on the screen before you get started with developing tizen applications, download and install the tizen studio for more information on the installation process, see the installation guide create a wearable native watch project using the tizen studio this step shows how you can use a predesigned project template that creates all the basic files and folders required for your project build the application after you have implemented code for the features you want, this step shows how you can build the application to validate and compile the code run the application this step shows how you can run the application on the emulator or a real target device design a ui this step shows how you can create the application ui and make small alterations to it to improve the usability of your application when you are developing a more complex application, you can take advantage of the native tools included in the tizen studio to ease the tasks of creating functionality and designing the application ui creating a project the following example shows you how to create and configure a basic wearable native watch application project in the tizen studio an application project contains all the files that make up an application the following figure illustrates the application to be created the application screen displays the hello watch text and the current time, which continues to be refreshed every second while the application runs figure wearable native watch application to create the application project launch the tizen studio in the tizen studio menu, select file > new > tizen project the project wizard opens in the project wizard, define the project details the project wizard is used to create the basic application skeleton with the required folder structure and mandatory files you can easily create different applications by selecting an applicable template or sample for the project wizard to use select the template project type and click next select the profile wearable and version from a drop-down list and click next the version depends on the platform version you have installed and with which you are developing the application select the native application application type and click next select the watch template and click next define the project properties and click finish you can enter the project name 3-50 characters and the unique package id you can also select the location and working sets by clicking more properties the project wizard sets up the project, creates the application files using the default content from the template, and closes for more information on the project wizard and the available templates, see creating tizen projects with tizen project wizard you can see the created project in the project explorer view the most important files and folders include inc default folder for included source files res folder for resource files used by the application only shared folder for resource files to be shared with other applications src folder for source code files lib folder for external library files tizen-manifest xml manifest file used by the platform to install and launch the application figure application in the project explorer note you can view and modify the application configuration in the manifest editor in this example, no configuration changes are required your application project is now ready for further actions next, build the application managing the application configuration to view and modify the application configuration in the project explorer view, double-click the tizen-manifest xml file of the application the tizen studio opens the file in the manifest editor in the manifest editor, view and modify the configuration details using the various tabs overview define general information, such as the package, label, and icon of the application features define required software and hardware features this information is used for application filtering in the tizen store privileges define the security-sensitive apis or api groups accessed and used by the application localization define localized values for the application label, description, and icon advanced define advanced features, such as application metadata and some miscellaneous options source view and edit the source code of the tizen-manifest xml file changes made and saved on the other tabs are reflected in the source code and vice versa note the tizen-manifest xml file must conform to both the xml file format and the tizen native application specification requirements editing the file in the source tab is intended for advanced users only to save any changes, in the tizen studio menu, select file > save all for more information on configuring the application, see setting the application manifest understanding the source code pay attention to the following main issues in the application source code in the inc/watch h and src/watch c files , to understand how the application is designed and how it works for source code details related to the ui, see designing a simple ui the watch application is initialized to use the functions and data types of the watch application api by including the <watch_app h> header file in your application #include <watch_app h> all header files that you need are already included in the watch h file, which is generated by the tizen studio when the template project is created the life-cycle callbacks manage specific parts of the application life-cycle they are set in the watch_app_lifecycle_callback_s structure, and the structure is passed to the watch_app_main function of the watch application api to start the watch application event loop int main int argc, char *argv[] { appdata_s ad = {0,}; int ret = 0; watch_app_lifecycle_callback_s event_callback = {0,}; app_event_handler_h handlers[5] = {null,}; event_callback create = app_create; event_callback terminate = app_terminate; event_callback pause = app_pause; event_callback resume = app_resume; event_callback app_control = app_control; event_callback time_tick = app_time_tick; event_callback ambient_tick = app_ambient_tick; event_callback ambient_changed = app_ambient_changed; ret = watch_app_main argc, argv, &event_callback, &ad ; if ret != app_error_none dlog_print dlog_error, log_tag, "watch_app_main is failed err = %d", ret ; return ret; } the create event is triggered before the application main loop starts in this callback, you can initialize the application resources, such as create windows and data structures static bool app_create int width, int height, void *data { /* hook to take necessary actions before the main event loop starts initialize ui resources and application's data if this function returns true, the main loop of application starts if this function returns false, the application is terminated */ appdata_s *ad = data; create_base_gui ad, width, height ; return true; } the time_tick event is triggered at least once per second the watch applications can get the current time from the watch_time time handle to draw a normal watch static void app_time_tick watch_time_h watch_time, void *data { /* called each second while your app is visible; update the watch ui */ appdata_s *ad = data; update_watch ad, watch_time, 0 ; } note for more information on the application life-cycle callbacks, see applications an ambient mode is available on a low-powered wearable device in this mode, the watch application shows a limited ui and receives only the ambient tick event every minute to reduce power consumption the details of the limited ui drawn in the ambient mode depend on the device in addition, due to the ambient mode being a low power mode, there are limits to the colors that can be shown on the screen usually, when designing the ambient mode ui, draw it with limited colors cyan, magenta, yellow, red, green, blue, black and white , and use less than 15% of the pixels on the screen if you do not want to draw your own ambient mode ui, set the ambient-support attribute to false in the watch application manifest file to allow the platform to show a default ambient mode ui note to use the ambient mode, the user must enable it in the device settings in addition, on the galaxy watch device, the ambient mode activates only when you are wearing the watch on the wrist - the `ambient_tick` callback is triggered every minute while the device is in the ambient mode you can use the callback to update the time on your watch application in the ambient mode in this callback, do not perform time-consuming tasks and always update the ui as quickly as possible the platform can put the device to sleep shortly after the ambient tick expires ```c static void app_ambient_tick watch_time_h watch_time, void *data { /* called at each minute while the device is in ambient mode update watch ui */ appdata_s *ad = data; update_watch ad, watch_time, 1 ; } ``` - the `ambient_changed` callback is triggered when the ambient mode is enabled or disabled on the device you can use the callback to initialize your ambient mode ui ```c static void app_ambient_changed bool ambient_mode, void *data { if ambient_mode /* prepare to enter the ambient mode */ else /* prepare to exit the ambient mode */ } ``` building your application after you have created the application project, you can implement the required features in this example, only the default features from the project template are used, and no code changes are required when your application code is ready, you must build the application the building process performs a validation check and compiles your files you can build the application in the following ways automatically the automatic build means that the tizen studio automatically rebuilds the application whenever you change a source or resource file and save the application project to use the automatic build select the project in the project explorer view in the tizen studio menu, select project > build automatically a check mark appears next to the menu option you can toggle the automatic build on and off by reselecting project > build automatically manually the manual build means that you determine yourself when the application is built to manually build the application, right-click the project in the project explorer view and select build project figure manually building the application alternatively, you can also select the project in the project explorer view and do one of the following in the tizen studio menu, select project > build project press the f10 key you can have more than one build configuration to see the current active configuration or change it, right-click the project in the project explorer view and select build configurations > set active the default configuration is debug for more information, see building applications after you have built the application, run it running your application you can run the application on the emulator or a real target device running on the emulator to run the application on the emulator launch an emulator instance in the emulator manager in the tizen studio menu, select tools > emulator manager in the emulator manager, select a wearable emulator from the list and click launch if no applicable emulator instance exists, create a new one the emulator is launched in its own window you can also see the new emulator instance and its folder structure in the device manager generate a security profile before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have created multiple emulator instances, select the instance you want from the combo box in the toolbar before selecting to run the application if you select an offline emulator, it is automatically launched when you select to run the application confirm that the application launches on the emulator note if the emulator display has switched off, you cannot see the application launch to switch the display on, click the power key in the lower-right corner of the emulator 3 change the watch face <a name="watchface"></a> to change the watch face and make the installed watch application visible ![changing the watch face] https //docs tizen org/application/native/get-started/wearable-watch/media/watch_run_change_wn png 1 if the emulator display has been switched off, activate it by pressing the **power** key in the lower-right corner of the emulator 2 on the home screen showing the default watch face , press the **power** key 3 in the recent apps screen, select **settings \> watch faces and styles \> watch faces** 4 swipe right until you find your application icon, and select it the **clock changed** message is displayed 5 press the **back** key in the upper-right corner of the emulator device multiple times, until the home screen with your new watch face is shown ![application running in the emulator] https //docs tizen org/application/native/get-started/wearable-watch/media/watch_run_face_wn png while the application is running, the **log** view in the tizen studio shows the log, debug, and exception messages from the methods defined in the log macros to see the view, in the tizen studio menu, go to **window \> show view \> log** for more information on using the emulator features, see using emulator control keys, menu, and panel and using extended emulator features running on a target device to run the application on a target device connect the wearable target device to your computer define settings on the device go to settings > connections, and switch on wi-fi the device and the computer must be connected to the same wi-fi network note the ip address the device is using go to settings > gear info, and switch on the debugging mode in the terminal, enter the following commands cd tizen-studio/tools /sdb connect <ip address of galaxy watch> use the ip address you noted before instead of the terminal, you can also use the remote device manager for the connection in the first attempt, the connection fails and the device asks for user confirmation to allow galaxy watch to read log data, copy files to and from your computer, and install the application manually, click the accept mark in the device manager, confirm that the device is connected shown in the device list generate an author certificate before you run the application, you must sign your application package with a certificate profile in the tizen studio run the application in the device manager, select the device in project explorer view, right-click the project and select run as > tizen native application alternatively, you can also select the project in the project explorer view and do one of the following press the ctrl + f11 key click the run icon in the toolbar if you have both a connected device and existing emulator instances, select the device from the combo box in the toolbar before selecting to run the application confirm that the application launches on the target device like with the emulator, you can change the watch face in the device settings to see the watch application on the home screen note the application is launched using the default debug run configuration to create and use another configuration in the project explorer view, right-click the project and select run as > run configurations in the run configurations window, click the new launch configuration icon , define the configuration details, and launch the application by clicking run designing a simple ui the wearable watch application created with the watch template has a simple user interface with a label component showing the hello watch text and the current time hour, minute, and second the ui is created using efl in the ambient mode, the watch template ui is identical to the normal ui, except that is shows the current time without the seconds figure user interface in the watch template ambient mode on the right creating the basic ui the ui in the watch template contains the following components the efl ui always contains a window component, which is the root component of the entire ui the application uses the conformant component as a container for other ui components the label showing the hello watch text and the current time is implemented with a label component the ui is created in the watch c file data structure a pointer to the ui components is stored in the appdata_s data structure struct appdata { /* window */ evas_object *win; /* conformant */ evas_object *conform; /* label */ evas_object *label; }; typedef struct appdata appdata_s; ui creation the app_create life-cycle callback is called when the application main loop starts, and it calls the create_base_gui function to create the ui static bool app_create int width, int height, void *data { /* define system callbacks */ appdata_s *ad = data; create_base_gui ad, width, height ; return true; } ui components the create_base_gui function creates the ui components window, conformant, and label the function receives a pointer to fill in the appdata_s structure static void create_base_gui appdata_s *ad, int width, int height { the window object of the idle screen is retrieved with the watch_app_get_elm_win function of the watch application api the watch_time_h handle is created for managing the current time, and the evas_object_resize function is used to resize the window to fit the screen int ret; watch_time_h watch_time = null; ret = watch_app_get_elm_win &ad->win ; if ret != app_error_none { dlog_print dlog_error, log_tag, "failed to get window err = %d", ret ; return; } evas_object_resize ad->win, width, height ; the conformant component is used as a container for the other ui components the component is the first object added inside the window with the elm_conformant_add function the conformant component is set as a resize object of the window by using the elm_win_resize_object_add function it means that the conformant size and position are controlled by the window component directly the evas_object_show function makes the conformant component visible ad->conform = elm_conformant_add ad->win ; evas_object_size_hint_weight_set ad->conform, evas_hint_expand, evas_hint_expand ; elm_win_resize_object_add ad->win, ad->conform ; evas_object_show ad->conform ; the label component for the text and time is added with the elm_label_add function the label is added inside the conformant component, which is the label's parent the label is resized and moved so that it is located below the first third of the screen height ad->label = elm_label_add ad->conform ; evas_object_resize ad->label, width, height / 3 ; evas_object_move ad->label, 0, height / 3 ; evas_object_show ad->label ; the watch_time_get_current_time function retrieves the current time, and the update_watch function uses the current time to set the label component content finally, the watch_time_h handle is deleted ret = watch_time_get_current_time &watch_time ; if ret != app_error_none dlog_print dlog_error, log_tag, "failed to get current time err = %d", ret ; update_watch ad, watch_time, 0 ; watch_time_delete watch_time ; when all the ui components are ready, the evas_object_show function makes the window component visible this means that the window displays everything on the screen at once evas_object_show ad->win ; } modifying existing components when the basic ui exists, you can easily modify the components in the ui by using the component-specific functions, or more general evas object functions for example, the following modification to the label component changes the text color to red ad->label = elm_label_add ad->conform ; evas_object_color_set ad->label, 255, 0, 0, 255 ; evas_object_resize ad->label, width, height / 3 ; evas_object_move ad->label, 0, height / 3 ; evas_object_show ad->label ; figure modified label component showing the current time you can update the time on the screen with the time_tick in the normal mode or ambient_tick in the ambient mode callback both callbacks contain the current time handle, and call the update_watch function to update the label content on the screen static void app_time_tick watch_time_h watch_time, void *data { appdata_s *ad = data; update_watch ad, watch_time, 0 ; } static void app_ambient_tick watch_time_h watch_time, void *data { appdata_s *ad = data; update_watch ad, watch_time, 1 ; } in the update_watch function, the watch_time_h handle is used to retrieve the current time elements hour, minute, and second with the watch_time_get_hour24 , watch_time_get_minute , and watch_time_get_second functions of the watch application api the text for the label component is defined based on whether the normal or ambient mode is used , and set with the elm_object_text_set function static bool update_watch appdata_s *ad, watch_time_h watch_time, int ambient { char watch_text[text_buf_size]; int hour24; int minute; int second; if watch_time == null return; watch_time_get_hour24 watch_time, &hour24 ; watch_time_get_minute watch_time, &minute ; watch_time_get_second watch_time, &second ; if !ambient { snprintf watch_text, text_buf_size, "<align=center>hello watch<br/>%02d %02d %02d</align>", hour24, minute, second ; } else { snprintf watch_text, text_buf_size, "<align=center>hello watch<br/>%02d %02d</align>", hour24, minute ; } elm_object_text_set ad->label, watch_text ; }
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
These cookies collect information about how you use our website. for example which pages you visit most often. All information these cookies collect is used to improve how the website works.
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and tailor the website to provide enhanced features and content for you.
You have successfully updated your cookie preferences.