Reputation: 4993
Is is possible to open a mobile app on iOS via a universal link programmatically or is this only possible via a user click?
I'm guessing this may not be allowed for security reasons.
Process:
Outcome: There are several outcomes on my test devices.
Rather than the mobile app being opened the equivalent web page https://open.myapp.app is opened in the mobile browser. This has the banner at the top "Open in the myapp app" with the apps icon.
Same as one but do not get the banner at all.
Note that for some iOS devices I use rather than opening in the browser it pops up a message "Open this page in "myapp"?" Cancel Open. If I click open it opens in the app if I click cancel it opens in the browser as above.
Desired outcome:
The mobile app is opened rather than the web page.
Using a "user click":
It works fine if I have a webpage that has a button that opens the url https://open.myapp.app. This will open the mobile app no problems when the user clicks the button.
Other: I did note this article however the sub domain is not the same. The webpage is at https://action.mypage.app and the universal url is https://open.myapp.app:
When a user browses your website in Safari and taps a universal link in the same domain, the system opens that link in Safari, respecting the user’s most likely intent to continue within the browser. If the user taps a universal link in a different domain, the system opens the link in your app.
Update:
I currently have this working by having a direct link from the email button/url to https://open.myapp.app and this opens in the app as expected. I have removed the Sendgrid tracking and any custom action logging I am doing. I guess if I want to log the action I will need to do that from the mobile app when it opens.
Upvotes: 4
Views: 3520
Reputation: 41
Apple has limited Universal Links in certain situations:
What I suppose to do is to add an extra domain to host the buttons, and use window.location.href
instead of a href
Upvotes: 4