iOS和Android共享HTTP深度链接? [英] iOS and Android Shared HTTP Deep Linking?
问题描述
我正在尝试通过URL(通过电子邮件等共享)启动本机应用程序。似乎Android仅响应HTTP深度链接URL(例如, http://myapp.com/stuff ),而iOS仅响应到非HTTP自定义深层链接URL(例如,myapp:// stuff)。是否有人找到了使两个操作系统都可以打开相同URL的单一解决方案?
I am trying to launch my native app through a URL (shared via email etc). It seems that Android only responds to HTTP deep link URLs (e.g., http://myapp.com/stuff), and that iOS only responds to non-HTTP custom deep link URLs (e.g., myapp://stuff). Has anyone found a single solution to enable both OS's to open the same URL?
此外,iOS是否可以使用HTTP深度链接URL?类似于 http://youtu.be 打开本机iOS应用的方式。 Facebook也这样做。
Also, is it possible for iOS to use HTTP deep link URLs? Similar to how http://youtu.be will open the native iOS app. Facebook does this too.
谢谢! :)
推荐答案
本文可能对 iOS和Android的URL方案有用: http://fokkezb.nl/2013/09/20/url-schemes-for -ios-and-android-2 /
This article can be usefull "URL schemes for iOS and Android": http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
编辑:
向用户发送网站链接的主要思想。使用服务器上的平台检测,我们可以返回正确的链接:
Edited: The main idea to send user a link to a website. Using the platform detection on server we can return correct link:
function open() {
// If it's not an universal app, use IS_IPAD or IS_IPHONE
if (IS_IOS) {
window.location = "myapp://view?id=123";
setTimeout(function() {
// If the user is still here, open the App Store
if (!document.webkitHidden) {
// Replace the Apple ID following '/id'
window.location = 'http://itunes.apple.com/app/id1234567';
}
}, 25);
} else if (IS_ANDROID) {
// Instead of using the actual URL scheme, use 'intent://' for better UX
window.location = 'intent://view?id=123#Intent;package=my.app.id;scheme=myapp;launchFlags=268435456;end;';
}
}
这篇关于iOS和Android共享HTTP深度链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!