简体   繁体   English

使用HKWorkoutSession时如何避免将手表应用放在前面?

[英]How to avoid keeping watch app in front when using HKWorkoutSession?

I have developed an iPhone app with watch app for getting live stream of heart rate. 我开发了带有手表应用程序的iPhone应用程序,以获取实时心率流。 As mentioned in many stackoverflow threads iOS get heart rate from Apple Watch in near real time , i have used HKWorkoutSession to get the updated heart rate and sending it to server (Workout session will always be active to get live stream of heart rate) . 如许多stackoverflow线程中所述, iOS近乎实时地从Apple Watch获取心率 ,我使用HKWorkoutSession来获取更新的心率并将其发送到服务器(锻炼会话将始终处于活动状态以获取实时心率流)

The issue here is, this application always stays in front of watch app(which is the expected behaviour when we use HKWorkoutSession ). 这里的问题是,此应用程序始终位于监视应用程序的前面(这是我们使用HKWorkoutSession时的预期行为)。 But i don't want this behaviour to happen, since the app only does the job of getting heart rate updates and sending it to server. 但是我不希望这种行为发生,因为该应用程序仅执行获取心率更新并将其发送到服务器的工作。

My app now sends the heart rate correctly to server even when the watch screen is off and when the app is in background since i have used Required background modes (Watch) in info.plist . 我的应用程序现在即使在手表屏幕关闭且应用程序在后台的情况下也可以将心率正确发送到服务器,因为我已经在info.plist中使用了必需的 后台模式(手表)

Is there any way that we can avoid this app being in front of watch face every-time the user opens the watch? 有什么方法可以避免每次用户打开手表时此应用都位于表盘前面?

You cannot avoid making you app frontmost while in a workout session on watchOS. 在watchOS上进行锻炼时,您无法避免将您的应用置于最前面。 You should file a bug with Apple to request an API with the behavior you want for your app. 您应该向Apple提交错误,以请求具有您想要的应用行为的API。

暂无
暂无

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

相关问题 当watchOS应用程序使用HKWorkoutSession在后台运行时如何使WCSession可访问 - How to make WCSession reachable when the watchOS app is running in background with HKWorkoutSession WatchOS sendMessage仅在观看应用回到前面时发送 - WatchOS sendMessage sent only when watch app come back to front 如何在没有苹果手表应用程序的情况下使用cordova在Apple Watch上获取iPhone应用程序的推送通知? - How to get Push Notifications of iPhone App on Apple Watch using cordova without apple watch App? 如何避免Apple Watch 2 App在屏幕变黑几秒钟后停止运行? - How to avoid an Apple Watch 2 App to stop running after a few seconds the screen turns into black? WatchOS:每当启动 NRC 或 Runtastic 等第二个应用程序时,HKWorkoutSession 就会结束 - WatchOS: HKWorkoutSession ends whenever a second app like NRC or Runtastic is started 即使应用程序在后台使用GPS,如何避免电池电量耗尽 - How to avoid battery drainage if the app is using GPS even when the app is in background 当应用程序在后台时如何在键盘前显示keyWindow? - How to show keyWindow in front of keyboard when app in background? HKWorkoutSession:在watchOS 2中关闭屏幕时未获得心率 - HKWorkoutSession: Not getting Heart Rate when screen is turned off in watchOS 2 如何在手表应用程序中缓存图像? - How to cache images in watch app? 如何在Apple Watch上安装App - How to install App on Apple Watch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM