링크:
[1] https://developer.tizen.org/blog/developing-tizen-.net-application-tizen.multimedia
[2] https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1AlarmManager.html
[3] https://developer.tizen.org/development/tizen-.net-preview/samples
[4] https://developer.tizen.org/ko/Creating%20Project%20UI
[5] https://developer.xamarin.com/api/type/Xamarin.Forms.Label/
[6] https://developer.xamarin.com/api/type/Xamarin.Forms.DatePicker/
[7] https://developer.xamarin.com/api/type/Xamarin.Forms.TimePicker/
[8] https://developer.xamarin.com/api/type/Xamarin.Forms.Slider/
[9] https://developer.xamarin.com/api/type/Xamarin.Forms.Entry/
[10] https://developer.xamarin.com/api/type/Xamarin.Forms.Button/
[11] https://developer.tizen.org/ko/Creating%20an%20Alarm
[12] https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1Alarm.html
[13] https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/introduction/
[14] https://developer.tizen.org/ko/Binding
[15] https://developer.tizen.org/ko/Adding%20the%20Privilege
[16] http://tizen.org/privilege/notification
[17] http://tizen.org/privilege/alarm.set
[18] http://tizen.org/privilege/alarm.get
[19] https://developer.tizen.org/ko/Running%20the%20App
[20] https://developer.tizen.org/sites/default/files/users/user-42763/1_alarm_app_image3.png
[21] https://developer.tizen.org/sites/default/files/tizenalarm.zip
[22] https://developer.tizen.org/ko/blog/developing-tizen-.net-applications-alarm-manager
Developing Tizen .NET Applications with Alarm Manager
In the previous blog we learnt how to get started with Tizen .NET application, and how to develop a Drumpad application [1]. In this blog we will learn about how to create a simple alarm application using Tizen AlarmManager APIs [2].
Prerequisites
The following tutorial assumes that you understand the structure of Tizen .NET application, and how to design UI using XAML file. If not, refer to the Drumpad application [1].
Steps
The following are the steps involved in creating the alarm application:
Alarm Application Overview
This sample app is a simpler version of the Tizen Clock sample application [3]. This app uses the AlarmManager APIs [2] to create a simple alarm using Xamarin.Forms portable application.
Using this app, the user can set an alarm with a reminder text. When the alarm is triggered the user will get a notification with the reminder text.
Creating Project UI [4]
In this sample app, XAML is used to design the UI in the TizenAlarm (portable) code. The required UI controls are:
The following are the steps to add the above listed UI controls over a StackLayout:
The following is the code in AlarmPage.xaml:
AlarmPage.xaml has a corresponding AlarmPage.xaml.cs file were the events can be handled when the user clicks the Add Alarm button.
Set AlarmPage as the Main Page of the application in TizenAlarm.cs by adding the following code in public App() function:
MainPage = new NavigationPage(new AlarmPage());
Build and run the application.
The following is the screenshot of the app:
Creating an Alarm [11]
Alarm [12] API is part of Tizen C # Native APIs, and hence cannot be directly called from the portable application. Using Dependency Service [13] framework of Xamarin.Forms you can call the Tizen project from the portable project.
The following are the steps involved to create an alarm:
Binding Alarm Creation to Button Click Event [14]
Once you have created the alarm, the final step is to call the TizenAlarmSetter SetAlarm () method from the TizenAlarm (portable) application. In AlarmPage.xaml.cs file, add click event handler for the button as follows:
And implement the event handler function as follows:
Adding the Privilege [15]
This app requires the following privileges:
You can add this privilege to the tizen-manifest.xml file.
Running the App [19]
Press CTRL+F5 to launch the application on the device/emulator, and
When the alarm is triggered a notification with the reminder text is displayed as follows:
[20]
For more details, refer to the attached source code.