Service Application with periodical vibration signal

Service Application with periodical vibration signal

BY 25 Mar 2021 Tizen .NET

Hello!

I have no expetience in Tizen development (sorry fo this), but I have to create Tizen service application with periodical vibration. I tried to do it based on this C# service: https://github.com/Samsung/Tizen-CSharp-Samples/blob/master/Wearable/ServiceApp/ServiceApp/ServiceApp_App.cs I plan to use Alarm for sending signal to sevice for vibration. I’ve added to tizen-manifest.xml next section:

<privileges>
    <privilege>http://tizen.org/privilege/haptic</privilege>
	<privilege>http://tizen.org/privilege/alarm.get</privilege>
	<privilege>http://tizen.org/privilege/alarm.set</privilege>
	<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
  </privileges>

And I tried to create service with sending AppControl alarm to the same service (my service has AppID): 

org.tizen.example.TizenVibroService

 Here the example of code:

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

            AppControl appControl = new AppControl();
            appControl.ApplicationId = "org.tizen.example.TizenVibroService";
            appControl.Operation = AppControlOperations.Default;

            DateTime dt = AlarmManager.GetCurrentTime();
            Alarm myAlarm = AlarmManager.CreateAlarm(dt.AddSeconds(20), appControl);
        }

        protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
        {
            base.OnAppControlReceived(e);

            int CurrentHour = (DateTime.Now).Hour;
            if (CurrentHour >= StartHour && CurrentHour <= EndHour)
            {
                string pattern = "Schedule";
                Feedback feedback = new Feedback();
                feedback.Play(FeedbackType.All, pattern);
            }
        }

But when I tried to run this application on emulator, I’ve got error: “NotPermittedApperror occured”. I tried to find the description of this error, but I couldn’t find it.

Someone may explain please, what’s the issue I’ve got ?

Also I tried to find good C# code example for creation the alarms for wearable tizen application, but also, couldn’t find it. May somebody to provide links to these code examples (if it present).

Thank you

Written by