Truecaller SDK uses universal links to handle the redirection between Truecaller app and your app. The process involves 4 steps, as defined below :
User taps the “Sign up with Truecaller” option on your app
Universal link opens Truecaller app
User taps “Continue” button on the Truecaller verification screenD. Universal links opens your app
How Universal Links works
Associated domains are used to notify the OS that these are the universal links supported by Truecaller SDK.
On tapping a URL or when the app calls openURL request, the OS will check if any of those apps have an associated domain related to the URL which is being opened.
If there is one, the OS tries to check for AASA ( apple-app-site-association ) files related to the domain and if the file consists of the path, it opens the app and transfers control to the app.
If any of the above is missing ( the AASA or the path), it will redirect the url to Safari.
What are associated domains
We need to host a file named AASA ( apple-app-site-association ), which has all the URLs or URL extensions, which can be used to open the app.
For example: If you have your app named "xyz" and you need to open your app on tapping a url https://xyz.com/register , you need to host an AASA file under the url https://xyz.com/apple-app-site-association.
Example of a sample AASA File to open your app for URL: https://xyz.com/register
We already cover the steps for creating and hosting the AASA file for you on registering your app in truecallerdevs.com.
You can check if the AASA for your app is available at: YOUR_APPLINK( provided by Truecaller )/.well-known/apple-app-site-association
It should look like: https://si44524554ef8e45b5aa83ced4e96d5xxx.truecallerdevs.com/.well-known/apple-app-site-association P.S : change the italic part to your app link.
How is the OS is notified about Associated Domains
Apple documentation on associated domains can be found here. Once you enable the associated domain capability for your app id, you can add associated domains entitlements with the necessary app links and web credentials. This is one of the steps in Truecaller SDK integration.
The OS on first installation of your app will try hitting these URLs for ./well-known/apple-app-site-association endpoints and if there is a file at the endpoint, it is downloaded to the OS. If the file is downloaded without any error, all the urls you specified will take the user to the app and if not, you will be redirected to Safari browser as if trying to open a normal URL. If there is an error in downloading the AASA file, we as the SDK or your app will not be manually able to download the file and hence it will keep on redirecting to safari. There is a three hour window of retry for AASA files depending on different status codes, that is the OS will retry downloading the AASA file after 3 hours and if it succeeds, all the redirections to your app works properly.
What to do if you face the safari redirection issue while testing the Truecaller iOS SDK integration with your app ?
If you encounter the safari redirection issue while integrating the Truecaller SDK with your iOS app, that probably means there’s some issue in downloading the AASA file for either your application or for the Truecaller app on your device. In such a scenario, you should try uninstalling and reinstalling your app build as well as Truecaller app from the device you are testing on, and re-try the flow after sometime. Usually, it may take a few hours ( as mentioned in the above section ) for the retry mechanism to kick in and download the updated AASA file on the device. Once that is successful, the flow should work absolutely fine.