Hi, I am developing a wearable app using Tizen 4.0. There is a timer that always runs on the background and I need to vibrate and play a sound when timer finish and the application is not displayed. I am calling Power.RequestCpuLock(0) before vibrating and playing sound and immediately release the cpu with Power.ReleaseCpuLock() after it. my question: is this the way to do it? maybe there is a better practice to achieve this behavior?
This is how my method looks like:
private void DingUser()
{
Device.BeginInvokeOnMainThread(() => Power.RequestCpuLock(0));
// vibrate
DependencyService.Get
// ding
this.PlaySound();
Device.BeginInvokeOnMainThread(() => Power.ReleaseCpuLock());
}
Thank you.
Vibrate when application running on background
编辑者为: JONATHAN APPLEBAUM 开 17 10月, 2019
查看选择的答案