How do Apple detect if an iphone app is installed when clicking on a pure html link? - ios

I am trying to detect if my ipad app is installed on a device when visiting my website, in order to suggest different action to the visitor.
Thanks to this post :
https://stackoverflow.com/a/8310348/1128754
I found that the "store" application on iphone seems to have achieve to detect if the app is installed on the device. When you click on store links, it launch the app instead of going to the mobile web version.
For example, if you go to :
http://store.apple.com/xc/anythinghere
with an iphone on which apple store app is installed ( http://itunes.apple.com/app/id375380948 )
it automatically start the store app, instead of the web page.
I tried to follow the stack call with mitmproxy but safari doesn't seems to ask query before launching the app.
So, I guess they did custom url scheme recognition, with http:// links.
Do you think it is possible?

This is done with URL protocol handlers:
http://www.iphonedevfaq.com/index.php?title=URL_schemes#URL_Protocol_Handlers

You cannot detect if an app is installed from HTML, but you can launch an app. For example, the popular game "Doodle Jump" can be launched by going to doodlejump://, but if you don't have it installed, the link won't work. As mentioned, this is done with a custom URL scheme and needs to be coded into your app.

Related

How to get any App's Bundle ID or App ID in iOS

Is there a way to know any App's bundle ID or App ID which is running in the foreground? I have seen this feature in this App called Backbone, which asks user to open any App, press a button on their hardware (Which is a game controller, connected to iPhone via lightning connector) and then a link/shortcut to that App gets added in their App. It seems like they are able to establish a link between their App and other Apps, based on what I know so far it is not possible without knowing the Custom URL scheme of the App.
Anyone knows if there is another way it can be done?
Thanks in advance!
URL Schemes are the only way to communicate between apps. So, no, it's not possible to launch any other apps.
But it is possible to launch any app that registers a URL Scheme, whether it's Apple's, yours, or another developer's.
For more info, check this question discussions.

when my app is not intalled, iOS universal link in UIWebView will launch Safari?

From Apple's guide in Support Universal Links:
When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
But i'm confused that if my app is not installed,and I tap a universal link of my app in another app's UIWebView,will the system launch Safari app to load my website,or still load it in the UIWebView?
I test some app's universal links when the app is not installed,and they never launch Safari to load the next page ,they still load it in the UIWebView.
I want to konw if it's possible to launch Safari,but not stay in UIWebView.Do I need any configuration in apple-app-site-association file?
Actually I want to trace where my app was installed from by using cookie.I can store a cookie in Safari with informations of the download page,and get the cookie with SFSafariViewController when my app is installed and opened,and present different views according to the cookie.
What you are trying to build is called 'deferred deep linking'. This (plus a lot more) is exactly what we provide at Branch.io. If you want to avoid the headache of configuring it all yourself, give this a look. Apps like Pinterest, Airbnb, and Tinder all use us for this reason.
Apple's documentation is referring to the default behavior with the standalone Safari browser. Handling links inside an app with UIWebView supersedes this, and there is no way to automatically bounce out of the origin app into the main Safari app.
The workaround is to store data on your own backend. As you've discovered, relying on a cookie pass-through on the device itself won't work in many cases.

swift open link in safari/app store

I have a simple iOS app and I'm in the process of developing a pro version of the app. I will then add a hyperlink to the existing app that will point to the url of the pro app in the app store. So is there any recommended way to do this so when the user taps the link, they will be forwarded to the pro app's page on the app store?
Will the user be redirected to the app store if I simply use this piece of code?
UIApplication.sharedApplication().openURL("http://itunes.apple.com/myappname")
As Far As I know, there's no longer
itms-apps://
instead of the regular http://
so the best way is to use this line of code, watch that I've put it in NSURL because you can't past a simple String. Other than that you can use ! at the end or better way is to use IF LET ...
UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/us/app/24-s-wt-h-plyqzyh-hyhydh-smqry/id897282272?ls=1&mt=8")!)
UIApplication.sharedApplication().openURL(NSURL(string : "itms-apps://itunes.apple.com/app/developerName")!)
With this one I couldn't open my app page on the App Store then I went to my iTunes page on Safari, copied my home page uri and pasted it to related code. And it works perfect!
Just copy your iTunes page on the internet and paste it!

Kiosk App in iOS can we provide any identifer to that app to use from URL scheme.

I wanted, to give some identifier to the app that we create like a kiosk mode in iOS.
i.e. We make add to home screen and it has an icon on home page which browse further.
Is there any way, where I can give some identifier Name to that link of app getting created so that we can get that app access from our Native and we can provide URL Scheme for the same.
Thanks.
iOS will not give access of all the url schemas. You can refer this document where the url schemas for selected application is given :
http://wiki.akosma.com/IPhone_URL_Schemes#Phone
It may be that the only way you can achieve what you want to do is to build an app around an iOS UIWebView. You can then include the camera functionality directly in the app, although there can be issues as a UIWebview doesn't handle things like popups that Safari does.

Is it possible to have an iOS webapp call another regular app to open? Works with Mobile Safari.

I am working with my web developers that are stuck on a problem with a Web-app we are creating.
The webapp works great, you add the website to your home screen on the ipad, open it and use the website within the webapp interface outside of safari.
The issue is that we have one function that doesnt work, where when clicking a URL link within mobile safari, it calls an external app (Optiscan- a qr code reader), and then when scanning the code, then returns you to Mobile safari.
The question is - is there a way to call a URL that will open an external app, from within a webapp? Similar to how it would work from mobile safari?
If so - i am then wondering if an app can be written that calls the webapp to open. For example if i needed the QR code reader to then re-open the web app and pass it the QR code.
-Dana
In iOS, native Apps can define Custom URL Schemes. If you know the scheme of an App, you can simply open it by clicking on a link like Launch Facebook App. This should launch the Facebook App for iOS if installed.
There was a crowd-sourced list of known URL schemes on akosma.com but they seem to have some problems and the list is not available as of writing this. If the URL scheme of the App you need to open is not public, try contacting the developer and ask for it. I'm sure if you ask kindly, he will help you ;-)
Edit: Almost forgot to say, opening Apps like this won't return to your Web-App magically. That's something the developer of said App would have to implement.
Edit 2: I found another website that has many custom URL schemes in it's database: http://handleopenurl.com. It does not have a URL scheme for Optiscan but for other QR Readers, maybe this will help you.

Resources