我正在尝试通过URL (通过电子邮件等共享)启动我的本机应用程序。似乎安卓只响应HTTP深度链接URL(例如,http://myapp.com/stuff),而iOS只响应非HTTP自定义深度链接URL(例如,myapp://stuff)。有没有人找到一个单一的解决方案,使两个操作系统都能打开相同的URL?
另外,iOS是否有可能使用超文本传输协议深层链接URL?类似于http://youtu.be打开原生iOS应用程序的方式。Facebook也是这样做的。
谢谢!:)
发布于 2015-08-06 16:25:23
这篇文章对“iOS和Android的网址方案”很有用:http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
编辑:主要的想法是向用户发送一个网站的链接。使用服务器上的平台检测,我们可以返回正确的链接:
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;';
}
}https://stackoverflow.com/questions/29435029
复制相似问题