Authorizing Garmin Connect on iOS Devices
Garmin has made changes in their iOS mobile app to redirect all Garmin site traffic to their Garmin Connect mobile app when the app is installed on the user’s phone.
With this change, if you are displaying the Inform marketplace in your iOS mobile app via an embedded webview, then your users will be directed to the Garmin app during connection/authorization.
This may cause issues in the Garmin connection workflow by interrupting the redirect back to the Inform marketplace once your user grants data sharing authorization.
Validic has reached out to Garmin about this issue and learned that this behavior is expected, though not ideal. If you support Garmin Connect as a marketplace integration in your iOS mobile app, you may want to take action to force behavior that works better with WKWebView and the Inform Marketplace.
You can use the following code example to implement behavior in your iOS app to force the link to openGarmin’s website rather than redirecting to the Garmin Connect app.
Control the redirect for all Inform Marketplace sources – this is our recommended solution, and should keep any Inform Marketplace source connection from redirecting into a native app.
This should be implemented in the WKWebView’s navigation delegate:
// WKNavigationDelegate
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull WK_SWIFT_UI_ACTOR void (^)(WKNavigationActionPolicy))decisionHandler {
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
if ([navigationAction.request.URL.absoluteString containsString:@"syncmydevice.com/connect/"]) {
decisionHandler(WKNavigationActionPolicyCancel);
[webView loadRequest:navigationAction.request];
return;
}
}
decisionHandler(WKNavigationActionPolicyAllow);
}
Be aware that this code sample has been tested with iOS version 18.1. You are highly encouraged to re-test this behavior with new iOS releases to ensure that OS behavior does not adjust its intended function.
Please also consider educating your users to complete the marketplace workflow using their system default browser if they continue to have trouble after you’ve made changes like the ones indicated above to control the redirect from your app.