Migrate from custom schemes (Android)
Migrate from custom schemes (Android)
Migrate from custom schemes (Android)
If your application currently uses custom URL schemes such as myapp://, Trustly recommends migrating to Android App Links. App Links are more secure and provide a better user experience because they are verified against your website, and they prevent other apps from hijacking your links.
To ensure a smooth transition, you should treat the migration as an extension process. Maintain support for the custom scheme to support older app versions while adding App Links as the primary method for modern users.
To support both link types simultaneously, you must keep your existing <intent-filter> for the custom scheme and add a new one for App Links. The following is the recommended methodology:
myapp://, continue to work.Open your AndroidManifest.xml file and add the following entry:
To ensure a successful migration, your handling logic must process the Uri in a scheme-agnostic way. Since Android delivers the complete Uri object to your Activity regardless of the source, you can create a single function to route the user.
The following example demonstrates how to handle both https and myapp schemes using the same logic.
By using standard Uri functions to get the path and parameters, you simplify maintenance. When the App Link is verified, it automatically takes precedence over the custom scheme without requiring you to rewrite your internal navigation logic.