How to use url scheme for application not installed in device - ios

I have an application in store, which allow to display a list of items in a first view, details of an item in the second view.
I use the url schemes to access to the details of an item from an external source (Facebook for exemple)
My question: if the application was not installed in the device, is there any way that allow to download the application and open it at the right item (using url scheme)
Thank in advance

For iOS>9
if ([[UIApplication sharedApplication] openURL:SchemaURL] == false)
{
[[UIApplication sharedApplication] openURL:iTunesAppURL];
}

What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).
Unfortunately there's no native way to accomplish this on either iOS or Android. URL schemes don't work, because they always fail with an error if the app isn't installed. Apple's newer Universal Links in iOS 9+ get closer in that they at least don't trigger an error if the app isn't installed, but you'd still have to handle redirecting the user from your website to the App Store. You can't pass context through to the app after install with Universal Links, so you wouldn't be able to send the user to the correct item, and they actually aren't supported in a lot of places.
To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do. A free service like Branch.io (full disclosure: they're so awesome I work with them) or Firebase Dynamic Links can handle all of this for you.

First Query that URLScheme and know about the status of the application whether it is installed or not. If it is not installed give him/her a popup to install that application from app store. You can navigate user to app store link when clicks OK from alert.

Related

How to shorten a Firebase Dynamic Link using my own domain name

I'm trying to implement Firebase Dynamic Links in an iOS app. The goal is to have a clean URL for marketing purposes so folks can share links on social media. The idea is folks will share the clean URL that starts with my domain name.
When the app is installed following a click on that link, we want to be able to track who referred the app install by looking at the payload delivered by Firebase. I think this goal is similar to Firebase's use case to convert web users to mobile app users.
An example link I would like to provide for sharing on social media is: http://example.com/my-payload-here
I've tried several cases but I'm not able to get the behavior I'm looking for in any case. Has anyone implemented this successfully before?
Here is my test procedure:
Uninstall the app
Send the link to be tested in an iMessage to myself
Tap the link on my iOS device (not using a simulator)
Install the app from the App Store
Launch the app after download completes by tapping "Open" button in the App Store
Below are my findings:
Short link generated from the Firebase Console (https://xyz.app.goo.gl/ABCD) - Link opens in App Store. I install the app. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the payload is delivered.
Long link identical to the "Long Dynamic Link" from the Firebase console for the link generated in #1 (https://xyz.app.goo.gl/?link=http://example.com/my-payload-here&isi=12345&ibi=com.example.MyApp) - behavior is identical to #1
Short link using my domain (http://example.com/redirect/my-payload-here, configured to 301 redirect to URL in #2) - Opens in App Store. I install. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the link still goes to the App Store.
Some questions I have:
Why isn't the payload delivered on the first launch for cases 1 and 2?
How can we make this launch the app and deliver the payload instead of going to the App Store?
I've also consulted the Firebase flowchart for the deep link in case 2.
Google Firebase team added support for custom subdomains to Dynamic Links.
You can now specify up to five custom page.link subdomains for your Dynamic Links. Short links using these new custom subdomains look like the following example: https://example.page.link/abcXYZ
Firebase Dynamic Link domains assigned on projects couldn't be deleted at this time.( firebase team is working on it.)
You can now whitelist the URL patterns that can be used as a Dynamic Link's deep link (link) or fallback link (ifl, ipfl, afl, ofl). If you define a whitelist, Dynamic Links won't redirect to URLs that don't match a whitelisted pattern.
You can try both of these features in the Firebase console.
This is not currently possible with Firebase. If you need whitelabeled URLs, you either need to build it yourself or use a more powerful link platform like Branch.io (full disclosure: I'm on the Branch team).
To answer your questions specifically:
I have implemented Firebase Dynamic Links in a testbed app and can confirm that linking through installation the first time does work for both long and short URL variants. There is likely something wrong with your AppDelegate config, so we can take a look at that if you want to share code.
Firebase does not support custom domains at this time. In theory (if you can solve the first issue above) you could get this working for first install by using a redirect like you have tried. However, you'll never be able to get it to launch the app with Firebase link data once the app is installed. This is because Universal Links work based on the domain of the link, and don't even request the web destination. Even if you enable Universal Links manually on your own domain, the app will open immediately without ever calling Firebase and the link data will never be set.

Universal Links opened in unsupported apps, are they completely lost?

I am trying to implement Branch marketing links in my app. I want for example to be able to create a link to share with users that will route them to a particular screen in the app. I noticed from the Branch docs that for some apps the link just opens the app store and not the actual app (even if it is installed). Being based in Asia I have the feeling that most of our customers will be wanting to share the link via an unsupported app such as Line. If a user is redirected to the app store via the link and then taps “open app”, what happens? Is the link meta data lost? Does the meta data only remain if the link is opened in an app such as mail or notes?
Alex from Branch.io here:
This list in the Branch documentation gives a partial list of apps that support Universal Links, but unfortunately it is not complete. We've tried to cover the most common apps.
Line is using a custom webview (not SFSafariViewController). It doesn't support Universal Links for the initial click, but this is one of the edge cases where Branch can detect the originating app and do some custom behavior. For Line, we trigger your app's URI scheme. This means the behavior your users see when clicking a Branch link from within Line is the same as Universal Links, even though Universal Links isn't actually the protocol being used.
If you want to handle other apps where Branch doesn't have a workaround like this, you could try enabling the deepviews feature. This will cause the link to open a content preview with a button to launch the app (or forward to the App Store if not installed).
When a user with the app already installed clicks the Open button on the App Store page, all the meta data is preserved and they will still be deep linked. Branch doesn't know (or care!) what happens between when the user clicks the link and the app launches, so that gives you plenty of flexibility.
Universal Links have some restrictions - not from Branch but from Apple's implementation. One of these restrictions is Universal Links cannot be opened from SFSafariViewController.
From Branch's docs, Line is not explicitly mentioned but other popular messaging apps may be of interest. I don't have Line myself but whether Line launches websites in it's own browser or the Safari app may give you a clue.
Facebook Messenger - works conditionally
WeChat - works conditionally
Twitter - works conditionally
LinkedIn - works conditionally
Any app using SFSafariViewController - works conditionally

IOS Deeplinking- Pass msg from email to your app

Existing user of the app will send email to other user.
Other user may have app installed or not installed on their device.
The email will contain some token. Now I want to pass that token to my app. I have read that by deep-linking, its possible. But how will I handle the case when other user have not installed my app yet in their IOS device.
Any help is appreciated.
What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app, even directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).
Unfortunately there's no native way to accomplish this yet on either iOS or Android. URL schemes don't work, because they always fail if the app isn't installed. Apple's new Universal Links in iOS 9 get closer, but you'd still have to handle redirecting the user from your website to the App Store
A free service like Branch.io (full disclosure: they're so awesome I work with them) can handle all of this for you though. Here's the docs page covering exactly how to create email links like you described: https://docs.branch.io/pages/emails/email-partners-list/

iOS Verify App Installation success

I want to create a cross promotion on my app, and give bonus stuff after user installs and runs my other applications. Is there any easy way to do this? I have looked at the iOS8 plugins functions, but this also needs to work on iOS7. Any suggestions?
Use custom URL schemes in both your apps and after that just check if the iOS system has the URL scheme registered. If so, then the user had installed the other app.
Here's an example on how to do it.
For this to work across multiple devices I'd probably say you'd need to implement a webservice that stores the users information such as a unique identifier for that user (Not device) so something like the users username and update it with the new app that they have just downloaded and installed and signed in using that username.
If this is just on a per device basis you could probably do it using Custom URL Schemes. Each of your apps would have a Custom URL Scheme and when the user opens the app you can do a check to see if any of the other Custom URL Schemes are installed on that device by using [[UIApplication sharedApplication] canOpenURL:] and if this returns true then that app is installed.
Here's the Apple Documentation for Inter-App Communication

iOS: How to get install referrer source

I want to find out how the user installed the app using what source (attribution).
For Android, it's possible to get the referrer's URL, but I haven't found an obvious way for iOS. There are external services such as AppsFlyer (http://support.appsflyer.com/entries/69796693-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deep-linking-) that let's you do this.
I noticed that starting iOS 8, developers could append the publisher id and the campaign id to the App Store URL for iTunes Connect Analytics (http://www.applift.com/blog/new-era-attribution-analytics.html). Is it possible to get the campaign id and the publisher id inside the app? I couldn't find any API changes or resources on this.
Any help would be appreciated. Thanks.
This has to be solved/implemented by Apple. If another company is coming out and saying they can solve this (Branch, etc.), they aren't being completely truthful.
The issue is that iTunes doesn't pass a referrer into the app, so without passing them the iOS IDFA on the click (redirect or out-of-bounds) every tracking method has to rely on Fingerprinting which drops off in attribution accuracy significantly past 24 hours.
This feature isn´t available in iTunesConnect as of yet (there´s no option for 'Analytics'). The only possibility I know is to sign up for the Affiliate Program (https://www.apple.com/itunes/affiliates/) and use the links generated there.
But maybe it will be available in iTC when iOS8 goes live...who knows!
And your second question: no, you can´t get the App Store URL via the iOS SDK. Apple suggests to copy it over from the AppStore in iTunes (via 'copy link'), e.g. https://itunes.apple.com/us/app/youtube/id544007664?mt=8. When you open this link via
[[UIApplication sharedApplication] openURL:]
iOS will automatically open the AppStore.

Resources