This documentation covers apliko_link 0.1.0 for Flutter.
Testing Links
Open a link on a running simulator or emulator:
# iOS simulator
xcrun simctl openurl booted "https://acme.nvgt.link/abc123"
# Android emulator or device
adb shell am start -a android.intent.action.VIEW -d "https://acme.nvgt.link/abc123"Close the app first to test an initial link, and leave it open to test a runtime link. If nothing arrives, check Platform Setup, that you did a full rebuild after adding the plugin, and Troubleshooting.
Test utilities
import 'package:apliko_link/testing.dart';
await AplikoLinkTesting.simulateFreshInstall();
AplikoLinkTesting.setMockDeferredLink('https://acme.nvgt.link/abc123');
AplikoLink.init('cl_test_…', enableDeferred: const EnableDeferred.all(true));simulateFreshInstall()makes the nextinit()behave like a fresh install and clears any mock link.setMockDeferredLink(url)stands in for the Play referrer on Android and for a pasted link on iOS (which still needsEnableDeferred(ios: true)). Call it beforeinit(). It always counts as a fresh install, so it can't test app updates.- Both are development-build helpers: in release builds they do nothing.
Test deferred links on real devices
The test utilities check how your app handles a deferred link. To check the whole journey, from tapping a link to the link arriving after the install, use a store build on a real phone.
Android: Google Play internal testing
Verify on your device. Google doesn't say whether installs from a testing track carry the link to your app. Treat these steps as a guide, and confirm on your own device that the link arrives.
Before you start
- A project in the Sandbox Hub with your Android app added: its Application ID and the SHA-256 fingerprints of your Play App Signing key and upload key. See your project in the Hub.
- An Apliko link from that project.
- A build of your app that uses your
cl_test_…key.
Steps
- In Play Console, upload the build under Test and release › Testing › Internal testing and roll it out.
- On the Testers tab, add your test Google account to an email list, then copy the opt-in link. It appears once the release is available.
- On the test phone, signed in to Google Play with that account, open the opt-in link and accept.
- Uninstall the app if it is installed.
- Open your Apliko link in the phone's browser. Don't paste it into the Google Play app. The link page sends you to Google Play.
- Install the app from Google Play and open it. The link arrives in your listener as a deferred link, with its data.
- To test again, uninstall the app and repeat from step 5, tapping the link again. Google Play keeps the link from the first tap, so reinstalling without a new tap brings no link.
If no link arrives
- Check
AplikoLink.getDeferredLinkResult().referreron the first launch after the install, once your listener has had a chance to run. It shows what Google Play passed for this install. If it containsutm_medium=organicornot%20set, Google Play passed no link: repeat steps 4 to 6, and make sure you open the Apliko link in the browser. On later launches it isnull. To see what the SDK found, turn ondebug: trueininit. - A build installed any way other than from Google Play, such as an APK copied to the phone or installed with
adb, never gets a deferred link. - If your own pages send users to Google Play, pass the full Apliko link, URL-encoded:
https://play.google.com/store/apps/details?id=com.example.app&referrer=<Apliko link>
iOS: TestFlight or a development build
An App Store or TestFlight install passes nothing to your app, so on iOS a deferred link reaches your app through the Paste button.
Before you start
- iOS deferred links turned on:
EnableDeferred(ios: true). - The paste UI in your app:
AplikoPasteHostin your widget tree (or anAplikoPasteButtonyou placed yourself). - Your iOS app added to the Sandbox Hub project (Bundle ID and Team ID).
- A device on iOS 16 or later.
Steps
- Delete the app from the device.
- In Safari, open your Apliko link and tap the button on the link page. It copies the link and opens the App Store.
- Install your build from TestFlight instead (or from
flutter runor Xcode; use--releaseto test the build you will ship), and open it straight away. Don't open any other link first. - The paste UI appears. Tap Paste. The link arrives as a deferred link, with its data, and is cleared from the clipboard (unless something else was copied in the meantime).
- To test again, delete the app and repeat from step 1.
If the paste UI doesn't appear
- Check that iOS deferred links are on, that this is the first launch after a fresh install (updating an existing install never offers it), that the app wasn't opened by a link, and that the clipboard still holds the Apliko link.
- With a development build, open the app soon after building it: an older build installed on a simulator can look like an update.
- To test your handling without a store install, use
simulateFreshInstall()andsetMockDeferredLink()(see Test utilities).
Debugging
Nothing is printed unless you pass debug: true to init. Every line then starts with [DeepLink DEBUG], [DeepLink WARN] or [DeepLink ERROR]. Your API key is never printed. If the app was built without the plugin's native part, a debug warning tells you to rebuild.
Troubleshooting
Each entry names a symptom and what to check. Turn on debug: true first: the log often tells you the cause.
iOS: links open the browser, not the app
- The Associated Domains entry matches your environment's host:
applinks:<sub>.nvgt.linkfor production,applinks:<sub>.sandbox.nvgt.linkfor sandbox. FlutterDeepLinkingEnabledisfalseinInfo.plist.- Your Team ID and Bundle ID are added to your project in the Hub. See your project in the Hub.
- After changing any of these, delete the app and install it again. iOS picks up the change on install.
Android: links open the browser, not the app
- The Hub has the SHA-256 fingerprint of every certificate that signs your app: your debug and upload keys, and the Play App Signing key for installs from Google Play.
- The intent filter's
android:hostis your environment's host, and it hasandroid:autoVerify="true". flutter_deeplinking_enabledisfalse.- Check verification on the device:
adb shell pm get-app-links com.example.appLink data is {}
- You pass a client key from the same environment as the link:
cl_test_…for<sub>.sandbox.nvgt.link,cl_live_…for<sub>.nvgt.link. A server key (sv_…) is never sent. - The link is on your project's host. Links on other domains or custom schemes always get
{}. Custom link domains are not supported yet. - The device is online. When it is offline, the link still arrives, with
{}. - Run with
init('…', debug: true)to see why the data could not be loaded.
Android: no deferred link
- The app was installed from Google Play through the Apliko link. A sideloaded build or
flutter rungets no link. - It is a fresh install. An existing user who updates never gets a link.
- Wait for a later launch. If Google Play doesn't answer in time, the SDK tries again on a later launch.
- If the store updated the app before its first launch, no deferred link is delivered.
- Clearing app data makes the next launch look like a fresh install, so a referrer or clipboard link can be delivered again.
- To test without the store, use
AplikoLinkTesting(see Test utilities).
iOS: the Paste button doesn't show
- The device runs iOS 16 or later.
- You passed
enableDeferred: const EnableDeferred(ios: true)toinit. - It is the first launch of a fresh install that was not opened by a link. The paste UI is not offered on later launches.
- A link is on the clipboard: the user tapped the button on the Apliko link page before going to the App Store, and copied nothing else since.
AplikoPasteHostis in your widget tree, or you placed anAplikoPasteButtonyourself. See iOS Paste Widgets.
A link is handled twice, or navigates twice
- Flutter's own deep linking is off:
flutter_deeplinking_enabledon Android andFlutterDeepLinkingEnabledon iOS arefalse. Otherwise the link is also pushed to yourNavigatoras a route. - You navigate from one central listener. Runtime links reach every listener, so two listeners that both navigate will navigate twice. See Central Listener.
Nothing arrives on desktop
Links are not delivered on macOS, Windows or Linux yet. getDataForUrl() works there.