Creating and running a project
In this tutorial, you will learn how to:
- Create a Tizen wearable project in Visual Studio 2019.
- Build a Tizen wearable project into a Tizen package file(.tpk file).
- Deploy and run a Tizen wearable application on a target; either the Tizen Wearable emulator or the Samsung Galaxy Watch.
Creating a new project
You can start building your application by creating a solution project. Follow the steps below to create a wearable Tizen .NET project:
Launch Visual Studio 2019.
Create a new project.
When you first open Visual Studio, the following window appears, click Create a new project. If Visual Studio is already open, you can create a new project by choosing File > New > Project on the menu bar or by clicking the New Project button on the toolbar.
Select a project template and click Next.
When the Create-a-new-project window appears, filter project templates by selecting C#, Tizen, and 5.5 from dropdown menus as shown in the image below.
You can select the appropriate template according to the app type you want. In this tutorial, we choose Tizen Wearable Xaml App template to target Tizen 5.5.Note: Select Tizen 4.0 if you're building an app for Galaxy Watch based on Tizen 4.0.
When the configure-your-new-project window appears, enter "MySteps" in the Project name edit box. Visual Studio will automatically update the Solution name edit box to "MySteps".
Change the disk location where your solution will be stored. Otherwise, it will be saved in
%USERPROFILE%\source\reposby default. Then click Create.
The Solution Explorer shows your Tizen .NET solution/project that you just created.
Here, we briefly introduce the folders and files in the Solution Explorer.
Don't worry if you cannot fully understand them right now. We will cover them in more detail later in the follow-up tutorials.
res/: the directory that contains the application's resources (images, audio, video, etc)
shared/: a folder that stores resources that can be shared with other applications
App.xaml: a source file that defines methods for application life-cycle and application-scope resources
MainPage.xaml: a source file that defines the initial page of MySteps
MySteps.cs: a source file that runs MySteps using the Xamarin.Forms framework on the Tizen platform
tizen-manifest.xml: a file that contains all the meta-data of the application.
Building your application
To build your application, click Build > Build Solution on the Visual Studio menu bar or press Ctrl+Shift+B.
If Visual Studio successfully builds the solution, it creates a Tizen package file named
org.tizen.example.MySteps-1.0.0.tpk. The Tizen Package (.tpk) is the package file format for installation and distribution of Tizen .NET apps.
You can check the full path of the created .tpk file in the Output window.
- Release build -
<the location of your project>/bin/Release/tizen60/org.tizen.example.MySteps-1.0.0.tpk
- Debug build -
<the location of your project>/bin/Debug/tizen60/org.tizen.example.MySteps-1.0.0.tpk
Deploying and running your application
To run your application, you must first deploy the built package file to a target: either an emulator or a real device. Deploying refers to transferring the package file to the target and installing it.
Run MySteps on an emulator
On the Visual Studio menu bar, select Tools > Tizen > Tizen Emulator Manager. Alternatively, click Launch Tizen Emulator on the toolbar to open the Tizen Emulator Manager.
When the Emulator Manager window appears, select Tizen 5.5 Wearable emulator and press the Launch button. If no applicable emulator exists, create an emulator instance.
Once you launch Tizen Wearable emulator, you can run your app in debug mode on it by using F5 shortcut key or use Ctrl-F5 shortcut key to start your app without debug mode.
If the deployment is successful, MySteps will run on the emulator as follows.
Run MySteps on Samsung Galaxy Watch
The connection between a PC and a Galaxy Watch requires a wireless connection. Thus, you need to have a wireless access point.
Turn on the debugging mode by toggling the switch button to On in Settings > About watch > Debugging.
Turn on the Wi-Fi connection in Settings > Connections > Wi-Fi and then select Wi-Fi networks. After the device has completed the scanning for wireless connections, select the Wi-Fi network that you wish to connect.
After the Galaxy Watch has connected to the Wi-Fi network, you need to check the IP address assigned to the device. This IP address will be used in the following steps by the Tizen Device Manager.
On the Visual Studio menu bar, open the Tizen Device Manager by clicking Tools > Tizen > Tizen Device Manager.
Open Remote Device Manager and click Add Device.
- In the Name edit box, write a name for your Galaxy Watch. (e.g. Wearable Watch)
- In the IP edit box, write the IP address of your Galaxy Watch.
- Leave the port number as it is.
- Click the Add button.
Toggle the Connection switch button to "ON".
Press Ctrl+F5 in Visual Studio to deploy and launch without debugging on the device, or press F5 to launch in debugger mode.
In this tutorial, you've learned how to create, build, and run a Tizen .NET app for Galaxy Watch. In the next tutorial, you'll learn how to create the main page of MySteps.