简体   繁体   English

如何在后台运行 watch os 应用程序

[英]How do I run watch os app in the background

Hello Any one know how to run a CoreMotion startDeviceMotionUpdates in the background for long period of time I basically made a coreML model to detect hair pulling(trichotillomania) motion that all works great and all,您好任何人都知道如何在后台长时间运行 CoreMotion startDeviceMotionUpdates 我基本上制作了一个 coreML model 来检测头发拉动(拔毛癖),一切都很好,

but now I need it to run in the background even when the screen is dim and I don't just want it as a session, but basically running for ever.但现在我需要它在后台运行,即使屏幕很暗,我不只是希望它作为 session,而是基本上永远运行。 There is something called Extended Runtime Sessions but it does not really work it is limited for short time and wasn't able to get it to work anyways.有一种叫做扩展运行时会话的东西,但它并没有真正起作用,它在短时间内受到限制,无论如何都无法让它工作。 https://developer.apple.com/documentation/watchkit/using_extended_runtime_sessions there doc are so vague and always have outdated samples. https://developer.apple.com/documentation/watchkit/using_extended_runtime_sessions那里的文档非常模糊,并且总是有过时的样本。

Please any one know how to run a this in the background.请任何人知道如何在后台运行这个。 Thank you谢谢

Not possible run application for long session in background for such task, you can just time to time awake application for ~10 seconds session every few hours.对于此类任务,不可能在后台长时间运行 session 应用程序,您可以每隔几个小时不时唤醒应用程序约 10 秒 session。

But, look at CMSensorRecorder, it's can recording all accelerometer data even application in background or inactive.但是,看看 CMSensorRecorder,它可以记录所有加速度计数据,即使是在后台或不活动的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 对于Swift中的Apple Watch OS,如何在WCSession激活完成后运行功能? - For Apple Watch OS in Swift, how can I have a function run after WCSession activation is complete? Apple Watch应用程序:在后台通过父iOS应用程序运行MKDirectionsRequest? - Apple Watch app: run an MKDirectionsRequest through the parent iOS app in the background? 如何在具有特定位置的Apple Watch中打开Maps App? - How do I open the Maps App in Apple Watch with a specific Location? 我如何在后台运行程序? - How do I have the program run in the background? 如何使用我的操作系统版本在 Apple Watch 上安装应用程序? - How to install app on apple watch with my version of OS? 如何从后台的配套手表应用程序启动主iOS应用程序? - How to start main iOS app from companion watch app in background? 如何快速访问Mac OS应用程序的undoManager? - How do I access the undoManager for my Mac OS app in swift? 如何将Iphone的远程通知传递给Watch OS? - How to pass the remote notifications I have for Iphone to Watch OS? 观看OS应用程序无法与iOS应用程序连接 - Watch OS app not able to connect with iOS app 使用 SwiftUI 时如何检查应用程序是否在 Apple Watch 上进入后台 - How to check if an app enters background on Apple watch when using SwiftUI
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM