I'm wondering if there is a way to open an app when clicking on a link in safari (or other browser) in iOS.
My app posts the name of a location, a screenshot on Twitter/Facebook which also has a link. I need to detect when the user clicks that link if he is on a pc or iOS device. If they're not on iOS device I want to continue to the linked page otherwise I want to open the app and also take take that location name as a parameter when opening it.
If the app has registered a custom URL scheme the device will open the particular app when it's asked to open a URL of a particular scheme.
This stems from the CFBundleURLSchemes key of your apps infoPlist. Apple's documentation has all the information you need to get started.
To register a URL type for your app, include the CFBundleURLTypes key
in your app’s Info.plist file. The CFBundleURLTypes key contains an
array of dictionaries, each of which defines a URL scheme the app
supports. Table 6-2 describes the keys and values to include in each
dictionary.
See more here at the iOS Programming Guide: Advanced App Tricks under 'Communicating with Other Apps' section.
Edit
In order to support the specific functionality of your question you need to go one step deeper.
Your first link needs to be a standard web URL.
The page presented from the first URL needs to detect the device and forward the user onto a second URL that will open the app on the device, with whatever parameters you want to forward to the app.
So - what you're going to have to do is build some sort of device detection into the page that your first URL points to. On that page, detect the device, then conditionally forward the user onto the second URL that will be the custom URL of your particular app.
It's possible to do this device detection, and detect if they have the app installed on their device with some of the newer HTML5 features supported by mobile browsers, but your question is themed around opening apps with URLs in iOS and the main native iOS hooks you need to support opening apps (with parameters and all) is in the documentation above.
Related
My URL is same as below, i will get this link to my mail from sendgrid and in iOS when i tap on this it always loads the browser first (safari most of the case) and opens in app preview page even though app is installed.
URL:<a clicktracking="off" href="https://{project_name}.page.link/?link=https://{project_name}.page.link/users/email_check/{{ $email_token }}&apn=com.{project_name}.app&isi={applestoreid}&ibi=com.{project_name}.app&efr=1">https://{project_name}.page.link/?link=https://{project_name}.page.link/users/email_check/{{ $email_token }}&apn=com.{project_name}.app&isi={applestoreid}&ibi=com.{project_name}.app&efr=1</a>
When you access a dynamic link in a browser. It will intentionally not go to your app because the actions indicate that your intent is to open a web page.
If you have your custom domain from Firebase ie: [your custom domain].app.goo.gl, send it into your link like so:
https://[your custom code].app.goo.gl/
And then tap that link. Does it open the app, or does it go to Safari? If it goes to Safari, it means that you haven't configured your iOS app for universal links yet, which is needed to support opening your custom domain url directly in the app. In Xcode, go to the Capabilities tab, and ensure that you've added the universal link domain as described in Apple's docs.
If you tapped the site address on the far top-right on iOS, it disables universal linking on that iOS app, until you long-tap and ask to open in the app again.
Second, you can't type in universal links into Safari's address bar and navigate to the app. Safari, by design, will open that URL in the browser. The easiest, most reliable way to test whether universal links are working is to put a universal link into the app, and tap the link from there.
I have to open my apps link in the app store in case the version number of the app they are using is not the most current version of my application. I know how to open it in the app store, but my app is for a few different countries so do i need to specifiy what appstore they have to download the app from? Like my apps in london and china, do i need to customize the url to open up those app stores?
The App Store page will be displayed based on the current user's phone locale.
Nothing to do on your side but using the generic link
The new "smart app banners" have a method where you can pass parameters to yor app so that it can know, for examples what page on your site the user was on before they bought your app. This is useful, for example, with a news site where you ant to show them the article you were previously displaying.
The way to do this with he smart app banners is:
<meta name="apple-itunes-app" content="app-id=311507490, app-argument=http://bookID/1234"/>
Is there a way to make a general link that does this, instead of a smart app banner?
The advantage of smart app banners is that the iOS detects if the app is installed or not. If it is installed on the device the banner opens the app directly. Otherwise it takes you to the app store.
A disadvantage is that they only show up in mobile safari and they require iOS 6.
As an alternative you could use custom URL schemes. The application has to implement this scheme. The URL would look like this: myapp://bookID/1234.
You can also check if this link works (app is installed) using javascript.
I just released an iPhone app and am updating its support site. I've used the iTunes Link Maker to create a link like below. One time, it opened iTunes, the rest of the times, it has not. I've tried closing iTunes, accessing the link from both Safari and Chrome, but each time I only see the iTunes preview in the browser.
Example:
My App on the App Store
ANSWER: (see discussion below)
Pulling the href from the "View in App Store" link in iTunes Connect:
My App on the App Store
NOTE: Trailing params might be different in your own case.
SEE ALSO:
http://www.apple.com/itunes/affiliates/resources/documentation/linking-to-the-itunes-music-store.html
I usually grab the link from the apps' detail page in iTunes Connect. There's a link named View in App Store that has worked for my so far. Just make sure to replace the locale identifier (defaults to us) in the link if your app is available in multiple stores.
Just use iTunes Link Maker and remove the country code (i.e. "us") out of the link and it would always work open iTunes always and not a browser on the way (if there is iTunes installed on the target system).
You can also remove the app_name you don't really need it (if your app name would be changed nothing happen, actually the name is ignored).
Possible duplicate:
How can i give app store link in my apps before approving another apps
linking to an app on the Itunes store
How to link to apps on the app store
Hi all,
I'm a littile bit confused. I need to provide the download link of my application (the iTunes link) inside my application. ie when the user would like to invite others via mail or some other means, have to provide the application link too with that.Is there any way to provide that before submitting the application to apple. Or i need to use the link as an update after getting my application approved by apple?
To be able to provide an iTunes URL, you should know the unique ID for your app and AFAIK, there's no way to get this ID before getting your app in the store first.
You can try and construct a search URL, but it doesn't always give the desired result. For example, I currently have only one app in the store, but there's another developer who uses the same developer name as me, so a search URL for my app produces two results. If this is your first app, and searching for your developer name produces no results, it could be safe for you to go with a search URL.
Even if you use a search URL, you will want to replace it with a proper iTunes URL in the first update.
Read this article by Bjango for more information on iTunes URLs and quirks of using search URLs: Dissecting iTunes links