How can a Developer Hand Over a Web Request to a Native iOS Application without displaying an error if the application is not installed? - ios

So, we've all pretty much seen it. I tap a google plus link in Safari and it opens in the native Google Plus app. If the app is not installed, it takes me to the store to download it. It's a seamless transition.
As a developer, I would like this type of integration with my web application and native application. I've seen a way to call the native app using a custom url scheme, but this throws a nasty alert if the app isn't on the device.
I thought that the way around it might be creating a Safari extension, but that's not do-able with mobile safari.
How can I achieve this seamless transition effect?

This answer might help you to determine whether the app was installed or not from web app.
iPhone browser: Checking if iPhone app is installed from browser
If it's not installed you can continue redirecting to your web app instead of myapp://
The code from one of our web apps
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
var messageContainer=$("#message");
if(!iOS)
{
messageContainer.html("Please open the link in your Apple mobile device")
}
else
{
setTimeout(function () {
messageContainer.html("Please install the app");}, 25);
window.location.href = "myapp://someInfo";
}

Related

ios - Web App lauched as Homescreen switches to browser mode after page change

The Web App works great on Android, stays in homescreen mode while browsing pages.
For some reason on iPhone and iPad it switches itself to a browser mode after changing page.
I have tested in chrome application tab, and all icons, manifest and service worker are loading fine on all pages.
What could cause the web app to change to browser mode on iOS?
You can try to disable it using Javascript as provided in this post:
var a=document.getElementsByTagName("a");
for(var i=0;i<a.length;i++)
{
a[i].onclick=function()
{
window.location=this.getAttribute("href");
return false
}
}
There's also a github forum which discusses this predicament.
Service workers are not yet supported in iOS devices. Unless the web app is programmed as a single-page application, I believe that it will always open it up in browser mode.

PWA added to homescreen, AccountKit not redirecting

After adding our PWA to homescreen, when going to the login flow, on Android accountkit opens a tab in chrome, whilst on iOS, it opens inside the PWA, then the flow is broken as accountkit gets stuck on the verified page.
Does anyone knows how to force accountkit to open in a browser tab?
You should either use the native iOS and Android SDKs for AccountKit, or if you prefer to continue using the web sdk, you must switch to the "Basic Web" SDK for AccountKit: https://developers.facebook.com/docs/accountkit/webbasic
The Basic Web SDK does not use any Javascript, which is the root cause of the issue in iOS webviews. You can read more about it in the FAQ: https://developers.facebook.com/docs/accountkit/faq/#faq_645353795617467

Can you launch **any** phone app from a web link?

Im making a phone automation system with a web interface. As part of this I am looking to replace all remote controls (tv media center etc) with my phone.
I have a Roku media player that has a remote control iOS app, what I am trying to do is to launch the Roku native phone app from my web interface.
I know it is possible to launch apps via href such as this:
Launches native FB app
But I have tried both these which fail
Fails to launch native 'Roku' app
Fails to launch native 'ROKU' app
So I have two main questions:
Is it possible to launch any app from a web link, or does the app developer need to enable that function in some way?
Answer - Yes the app developer will need to set a url schemer
Is there a way to determine the URL you would need to launch an app IE the Facebook app can be launched by fb:// but can you determine that anywhere?
Answer - There is a link to multiple URL schemers for popular apps below but my understanding is that the app developer would need to release them
Thanks
JS Fiddle just in case - https://jsfiddle.net/0znc12bs/
Update - as a point of reference I am not developing an app this is a
web service trying to connect to apps I didn't author.
Update2 - I have been in touch with Roku support and their remote app
currently doesn't support deep linking.
To open the app from the web url the app developer need to set the id (deep linking) setting and URL Schemas in the app
For the famous app you can find the deep linking url from the net,from that you can make your list to open the app
else you can find on it's site if they have written that
List of sites which can provides some list of url schemas which you can use to open app from the web :https://stackoverflow.com/a/11155918/4557505

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.

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

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.

Resources