Testing deep links on iOS and Android involves several methods, ranging from command-line tools to dedicated applications and integrated development environment (IDE) features.
1. Android Deep Link Testing
-
Using Android Debug Bridge (ADB) Shell Commands: This is a common and effective way to test deep links on an Android device or emulator. You can use the
adb shell am startcommand to simulate a deep link invocation.- Command:
bash adb shell am start -W -a android.intent.action.VIEW -d "your_deep_link_url" - Replace
"your_deep_link_url"with the actual deep link you want to test (e.g.,https://www.example.com/product?id=123). - This command starts the ADB shell with the
VIEWaction and specifies the deep link URL, verifying if the link navigates to the correct section of your app.
- Command:
-
Testing from Android Studio: Android Studio provides a built-in tool to test deep links.
- Navigate to
Tools > App Links Assistant. - Click
Test App Links. - Enter the URL you want to test and click
Run Test. - Alternatively, you can edit your run configuration in Android Studio, change the "Launch" option to "URL," and enter your deep link.
- Navigate to
2. iOS Deep Link Testing
-
Using Safari on a Simulator or Device: You can directly type your deep link URL (especially for URL Schemes) into Safari on an iOS simulator or a physical device.
-
Using
xcrun simctl openurlin Terminal: For testing on the iOS simulator, you can use thexcrun simctl openurlcommand.- Command:
bash xcrun simctl openurl booted "your_deep_link_url" - Replace
"your_deep_link_url"with your deep link. This will open the specified URL in the booted simulator, triggering your app if the deep link is configured correctly.
- Command:
-
Dedicated iOS Deep Link Testing Tools: Several tools are available to simplify deep link testing on iOS:
- DeepLinkr: A free macOS app that helps iOS teams document, test, and verify deep and universal links. It allows you to create projects, add links, and trigger them directly in the simulator or generate QR codes for device testing.
- Deeplink Checker: An iOS app designed for developers and marketers to test, inspect, and share deep link setups, including Apple App Site Association (AASA) files for Universal Links.
3. General Considerations for Testing Deep Links
- Types of Deep Links: Be aware of the different types:
- Default Deep Links: Only work if the app is already installed.
- Deferred Deep Links: Can direct users to the app even if it's not installed, often by redirecting to an app store and then preserving the deep link context after installation.
- Contextual Deep Links: Default or deferred deep links with added parameters for more specific actions or content.
- Testing Scenarios: Ensure you test both scenarios where the app is already installed and where it needs to be installed (for deferred deep links).
- Third-Party Tools: For deferred deep linking, consider using third-party services like Firebase Dynamic Links or Branch.io, which help manage and test these complex scenarios.