Skip to main content

Flutter Platform Setup

Configure Android App Links, iOS Universal Links and Flutter's deep linking settings for apliko_link.

This documentation covers apliko_link 0.1.0 for Flutter.

Your link domain is always a subdomain of nvgt.link, for example acme.nvgt.link; sandbox projects use acme.sandbox.nvgt.link (see your project in the Hub). Replace acme with your own subdomain below.

Before you start: your project in the Hub

Universal Links and App Links only open your app when your link domain says your app may open it. Apliko hosts those files for you, built from the app details you enter in the Hub. Do this once per environment.

1. Create a project

Create a project in the Sandbox Hub while developing and in the Production Hub for your released app. Each project has its own deep link subdomain, app settings and keys. The subdomain is permanent: every link you create uses it.

  • Production links: https://<your-subdomain>.nvgt.link/…
  • Sandbox links: https://<your-subdomain>.sandbox.nvgt.link/…

Use the exact host of the environment a build talks to in your app's Associated Domains and intent filter. A build that should open both sandbox and production links lists both hosts.

2. Add your apps to the project

PlatformFieldRequiredNotes
iOSBundle IDYesFor example com.example.app.
iOSTeam IDYes10 characters, under Membership in your Apple Developer account.
iOSApp Store IDNoThe number in your App Store link (apps.apple.com/…/id123456789). Recommended: it sends iPhone users without your app straight to your App Store page. Without it, they may go to your website instead.
AndroidApplication IDYesYour package name, for example com.example.app.
AndroidSHA-256 fingerprintsAt least oneFor apps installed from Google Play, add the Play App Signing key's fingerprint (Play Console › Test and release › App integrity); without it, links stop opening your app after release. Add your upload key too, and your debug key for local builds.
ProjectFallback URLNoWhere people go when they open a link without your app and it does not send them to a store, unless the link has a web address of its own.

Already have an apple-app-site-association or assetlinks.json file, for example from Firebase Dynamic Links? You can import it in the Hub instead of typing the details (up to 64 KB); Apliko then serves it as you saved it.

Changing the Bundle ID, Team ID or fingerprints of an app that is already connected changes whether every existing link opens it, so the Hub asks you to confirm first. Adding a fingerprint is always safe.

3. Check the hosted files

Once you add an app, these files are available on your link host:

  • https://<your-subdomain>.nvgt.link/.well-known/apple-app-site-association
  • https://<your-subdomain>.nvgt.link/.well-known/assetlinks.json

Open them in a browser or with curl to check your IDs and fingerprints. iOS fetches the file through Apple's own CDN when the app is installed, so a change can take a while to reach devices; reinstall the app to pick it up. On Android 12 and later, check verification with adb shell pm get-app-links com.example.app.

4. What a link does without your app

By default, a link opened on a phone without your app sends the user to the store, so a deferred link can reach your app after the install:

  • Android: the link opens your app if it is installed; otherwise Google Play opens with the full link as the install referrer, which the SDK reads on first launch.
  • iOS: the link page shows a short prompt; the user's tap copies the link and opens the App Store, so the Paste button can offer it on first launch (if you turn iOS deferred linking on).
  • Without a store page for the platform, or for a link set not to go to the store, the user goes to the link's own web address or your fallback URL.

5. Get your client key

On the API keys page of the Hub, create a key for the project and use its client key in your app: cl_test_… from the Sandbox Hub, cl_live_… from the Production Hub. The server key (sv_…) is for your backend only.

Android

Add an intent filter for your link domain to the main Activity in android/app/src/main/AndroidManifest.xml, and turn Flutter's own deep linking off so a link is not also pushed as a route:

xml
<activity android:name=".MainActivity" android:launchMode="singleTop" ...>
  <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="acme.nvgt.link" />
  </intent-filter>
  <meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
</activity>
  • android:autoVerify="true" makes it an App Link. Android verifies it against your link domain. Register your package name and every signing certificate SHA-256 (including the Play App Signing certificate) for your app in the Apliko Link Hub.
  • flutter_deeplinking_enabled=false makes sure one tap is handled once, by the SDK, instead of navigating twice.
  • The plugin adds the INTERNET permission, to fetch link data. Google's Play Install Referrer library, which reads the referrer, adds com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE.
  • The plugin also adds a non-exported ContentProvider with the authority ${applicationId}.link.apliko.flutter. It only starts the plugin's Activity tracker when the app process starts, and serves no data.
  • The plugin has no minimum Android version of its own; it follows your app's minSdk.
  • Custom-scheme links work with an additional intent filter, as in any Android app.

iOS

  1. Associated Domains. In Xcode, open the Runner target, then Signing & Capabilities, and add Associated Domains with applinks:acme.nvgt.link. Register your team ID and bundle ID for your app in the Apliko Link Hub.
  2. Turn Flutter's own deep linking off in ios/Runner/Info.plist, so one tap does not navigate twice:
    xml
    <key>FlutterDeepLinkingEnabled</key>
    <false/>
  3. Custom schemes (optional) go into CFBundleURLTypes as usual.

Scene-based apps. Current Flutter hands the scene callbacks to plugins, and the SDK registers for them by itself. If your app adopted UISceneDelegate on an older Flutter without that, forward links from your scene delegate:

swift
import apliko_link

func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
           options connectionOptions: UIScene.ConnectionOptions) {
  for activity in connectionOptions.userActivities { AplikoLinkFlutterPlugin.handle(activity) }
  for context in connectionOptions.urlContexts { AplikoLinkFlutterPlugin.handleOpen(context.url) }
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
  for context in URLContexts { AplikoLinkFlutterPlugin.handleOpen(context.url) }
}
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
  AplikoLinkFlutterPlugin.handle(userActivity)
}

In Objective-C use +[AplikoLinkFlutterPlugin handleOpenURL:] and +[AplikoLinkFlutterPlugin handleUserActivity:].

The plugin supports CocoaPods and Swift Package Manager. Its podspec asks for iOS 11.0 (Flutter 3.10's own minimum) and its Swift package for iOS 12.0. An app on an older Flutter built with a newer Xcode must raise its pods' deployment target in its Podfile, as it must for Flutter's own pod (current Flutter does this by itself):

ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
    end
  end
end

A link whose URL contains a port can't be opened as a Universal Link; this is an iOS limitation.

Web, macOS, Windows, Linux

Nothing to set up. On the web, your client key is sent from the browser to your link domain.