Create a Tizen .NET Application for Wearables
The Tizen .NET framework allows you to easily and efficiently create applications for Tizen. Study the following instructions to help familiarize yourself with the Tizen .NET application development process. With the instructions, you can create and run a basic .NET application, which displays some text on the screen with no user interaction.
- Before you start developing Tizen applications, set up the development environment.
- Create a Project using Visual Studio.
This step shows how you can use a predesigned project template that creates all the basic files and folders required for your project.
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.
This step shows how you can deploy and run the application on the emulator or a real target device.
Create a Project
The following example shows you how to create and configure a basic Tizen .NET application project in Visual Studio. An application project contains all the files that make up an application.
The following figure illustrates the output of application.
To create a new Tizen .NET project:
- Launch Visual Studio 2019. (Visual Studio 2017 is also supported.)
- In the Visual Studio menu, select File > New > Project.
A New Project window appears.
- Select C# in languages and Tizen in platforms, select Blank App (Xamarin.Forms) template. Be aware that templates are provided depends on Tizen platform version. A template for
Tizen 4.0is selected in this instruction.
Using Tizen Wearable App and Tizen Wearable Xaml App templates are recommended for a better developing experience of a circular shape application. Tizen.CircularUI is referred by default on those templates and this library provides rich UI components that fit perfectly on circular shape Wearables. Tizen.CircularUI is a Xamarin.Forms extension, and you can visit here to see what you can do more with it.
Here is how Tizen Wearable Xaml App template is structured:
Define the project properties and click Create. You can enter the Project name, Location, and Solution name.
The Tizen Project Wizard pop-up window appears.
- Select the profile, Wearable (preview). Click OK.
If you select the Common profile, you cannot select Mobile, TV, or Wearable.
The following figure illustrates a solution with two projects created and displayed in the Solution Explorer view:
- The <projectname> project contains the Xamarin.Forms code shared across platforms.
- If you select the common profile in the Tizen Project Wizard, a common project titled <projectname>.Tizen is added. It contains code to instantiate your common application within the Tizen framework.
- If you select the wearable profile in the Tizen Project Wizard, a wearable project titled <projectname>.Tizen.Wearable is added. It contains code to instantiate your wearable application within the Tizen framework.
If you are already familiar with Xamarin.Forms, this project has the same structure as a Xamarin.Forms portable application. The <projectname> project is the portable class library and the others are the platform-specific projects; however, in Tizen .NET, only the Tizen platform-specific project is generated.
.cs file in the portable project already contains simple Xamarin.Forms code that makes a basic UI.
Build Your Application
The building process performs a validation check and compiles your files. You must sign the application package with an author certificate when building the application.
Sign Application with Author Certificate
Using the default certificate If you do not need to upload your application to App Store, you can use a default certificate and deploy your application in the Tizen Emulator for testing purposes.
To use the default certificates,
- In the Visual Studio menu, go to Tools > Options > Tizen > Certification.
- Uncheck the Sign the .TPK file using the following option. checkbox.
Using the Samsung certificate You have to create a Samsung Certificate to install your application on an actual target device or upload your application to Samsung Galaxy Store Seller Portal. Check out here to learn about getting Samsung certificate.
Build Your Application
There are two different ways to build the application:
- In the Visual Studio menu, select Build > Build Solution.
- In the Solution Explorer view, right-click the solution name and select Build Solution.
Tizen .NET applications are always deployed as installed packages. The package files have the
.tpk file extension, and the process of generating a package is controlled by the manifest file. The Visual Studio template generates the manifest file (tizen-manifest.xml) to the top level of the <projectname>.Tizen project (if you create projects with mobile, TV, or wearable profiles, a separate manifest file is generated for each profile).
After you have built the application, deploy and run it.
Deploy and Run Your Application
To run the application, you must first deploy it to the target: either a device or an emulator. Deploying means transferring the package file (
.tpk) to the target and invoking the Tizen package manager to install it.
To deploy and run the application on the emulator:
- In the Visual Studio menu, select Tools > Tizen > Tizen Emulator Manager. Alternatively, click Launch Tizen Emulator in the Visual Studio toolbar to launch the Tizen Emulator Manager.
- In the Emulator Manager, select an emulator from the list and click Launch.
If no applicable emulator instance exists, you can create one.
- Once you launch an emulator instance, you can deploy the application by clicking the emulator instance in the Visual Studio toolbar. In the Visual Studio toolbar, you can select the target from the drop-down list to change the deployment target.
- If the deployment is successful, the application launches on the emulator. The following figure shows the launched application on the wearable emulator:
Visit Testing Your App on Galaxy Watch to learn about running your application on Galaxy Watch.