I'm developing a watchOS app for Watch Ultra 2 that implements water detection using CMSubmersionManager.
I would like to make it appear in the Auto-Launch settings menu, but my app is not appearing in the settings (Settings > General > Auto-Launch > When Submerged > Selected App)....
What additional steps should I take to make this work?
Environment
- Device: Watch Ultra 2
- watchOS: 11.2
- Xcode: 16.0
Implementation
I have implemented the following as per documentation:
- Added the Shallow Depth and Pressure capability and Entitlement.
- Added the "Shallow Depth and Pressure" capability
- Confirmed entitlement "com.apple.developer.submerged-shallow-depth-and-pressure" was automatically added
Note: I initially thought I should use "com.apple.developer.submerged-depth-and-pressure" (without "-shallow") since I'm targeting a maximum depth of 6 meters, but this resulted in compilation errors.
ref: https://developer.apple.com/forums/thread/740083
ref: https://developer.apple.com/forums/thread/735296
- Added NSMotionUsageDescription and WKBackgroundModes
<key>NSMotionUsageDescription</key>
<string>Required for water detection</string>
<key>WKBackgroundModes</key>
<array>
<string>underwater-depth</string>
</array>
According to the documentation:
"It also adds your app to the list of apps that the system can autolaunch when the wearer submerges the watch."
What additional steps are needed to make the app appear in Auto-Launch settings? Has anyone successfully implemented this feature?
Yeah, I found a solution.
On Apple Watch Ultra, WKBackgroundModes = underwater-depth and the shallow-depth entitlement weren’t sufficient. Add a StartDiveIntent directly to the watch app target:
import AppIntents
struct StartAppDiveIntent: StartDiveIntent {
static let title: LocalizedStringResource = "Start App
static var openAppWhenRun: Bool { true }
func perform() async throws -> some IntentResult {
.result()
}
}
Then call WKExtendedRuntimeSession.requestAutoLaunchAuthorizationStatus only after the app is fully foreground-active. Without the intent, Ultra returns error 10; calling too early returns error 9. No full-depth entitlement or WKSupportsAutomaticDepthLaunch key is needed. The Simulator cannot validate this - test on physical hardware.