Samsung/Tizen-CSharp-Samples

How to create alarm from wearable service application.

andy-mishechkin opened this issue · 1 comments

Hello, All!
I need to send periodical vibration from wearable service application (like here: https://github.com/Samsung/Tizen-CSharp-Samples/blob/master/Wearable/ServiceApp/ServiceApp/ServiceApp_App.cs)
I try to use alarms for this: https://docs.tizen.org/application/dotnet/guides/alarm/alarms/#scenario_1
For example I've tried to set alarm to send notification:

protected override void OnCreate()
        {
            base.OnCreate();

            Notification notification = new Notification
            {
                IsVisible = true,
                Title = "TestNotification",
                Content = "This is a test notification",
                Count = 3
            };

            Notification.AccessorySet nAccessory = new Notification.AccessorySet
            {
                SoundOption = AccessoryOption.On,
                CanVibrate = true,
                LedOption = AccessoryOption.On
            };
            notification.Accessory = nAccessory;

            Alarm alarm = AlarmManager.CreateAlarm(1, 2, notification);
        }

But when I run this service application on Tizen Emulator I don't see any alarms. May you explain please how to create alarm from wearable service application, and, maybe there better solution for preiodical vibration realization then alarm ?

kilig commented

Hello andy.
I don't know if you added privileges for alarm and notification.
First, you should check for exceptions when using some Tizen api.
And second parameter of 'CreateAlarm(Int32, Int32, Notification)' does not guarantee the accuracy.
If you want to see the notification right away, use 'CreateAlarm(Int32, Notification)' method