2016-02-16 111 views
9

我正在寻找简单的解决方案来发布我的应用程序的一个链接,例如在Facebook上,如果用户通过移动设备访问它,它应该自动重定向到正确的应用商店。否则,用户应该被重定向到我的网站。将用户重定向到iTunes应用商店或Google Play商店?

iOS应用: http://itunes.apple.com/de/app/dawawas/id588285122

Android应用: https://play.google.com/store/apps/details?id=de.conceptspace.dawawas.greenturtle&hl=en

网站: https://www.dawawas.com/

回答

3

您可以用http://toSto.re一次创建一个短链接,iTunes和谷歌Play商店中。

只需选择一个名称并输入不同的应用程序商店,您就可以获得像toSto.re/facebook这样的链接,该链接根据用户代理自动指向正确的url,甚至支持Google Analytics迭代的某些统计信息。

7

你的意思是这样吗?

Onelink

如何使用onelink.to

onelink.to是链接到您的应用程序的轻松和无拘无束的方式!

只需将网址添加到您的应用,然后我们将决定每次有人使用您的onelink.to地址时要使用哪个网址。

您可以使用onelink.to 免费,私人和商业用途。我们没有计划改变这一点。

而且您还可以将备用网址添加到您的网站。

希望这有助于你。

+0

的目标是不使用第三party's。 – Chirry

+2

'目的不是使用第三方'你在哪里读这个?他想要一个** easy **解决方案,所以第三方可以成为他想要的解决方案。 – Strider

+0

如果应用程序已安装,您可以使用此第三方导航到某个活动/页面吗? – batmaci

0

您可以通过后端创建该功能。只需创建一个PHP脚本或后端正在使用的语言即可。在这里我正在假装PHP。

只需创建一个PHP脚本,将决定你使用iPhone或Android或web.check此链接,PHP脚本Mobile or desktop browser detection and redirect to respective web page

,重定向到相应的Url.Like您可以使用网站的网址与PHP文件 https://www.dawawas.com/detect_mobile.php

用户将共享此URL,当其他用户将点击上面的链接,然后PHP脚本,将决定它是否iOS或Android或网络和repective链接将通过重定向自动打开

我已经实现了这个在我们的iOS应用程序中。

4

在PHP中,你可以使用类似:

<?php 

$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); 
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); 
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); 
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); 
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS"); 

//do something with this information 
if($iPod || $iPhone){ 
    //browser reported as an iPhone/iPod touch -- do something here 
    $string = "Location: <<your itunes app link>>"; 
    header($string); 
    die(); 
}else if($iPad){ 
    //browser reported as an iPad -- do something here 
    $string = "Location: <<your itunes app link>>"; 
    header($string); 
    die(); 
}else if($Android){ 
    //browser reported as an Android device -- do something here 
    $string = "Location: <<Google Play Link>>"; 
    header($string); 
    die(); 
}else if($webOS){ 
    //browser reported as a webOS device -- do something here 
    $string = "Location: <<Your Page link>>"; 
    header($string); 
    die(); 
}else{ 
    //browser reported as PC -- do something here 
    $string = "Location: <<Your Page link>>"; 
    header($string); 
    die(); 
} 


?> 

您可以使用链接的iTunes或Android,分别为:

itms-apps://itunes.apple.com/app/<<App ID>> 
market://details?id=<<Package id>> 

我不记得来源,但至少它的工作原理对于我在Whatsapp等其他应用程序中共享,但不幸的是,它不适用于Facebook。

Facebook中的问题是,他们使用重定向路径上的最终链接的元数据,并指向GooglePlay商店。

11

如果你想推出自己的,而不是使用第三方,也有一个JavaScript解决方案:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8" /> 
<script> 
function getMobileOperatingSystem() { 
    var userAgent = navigator.userAgent || navigator.vendor || window.opera; 

     // Windows Phone must come first because its UA also contains "Android" 
    if (/windows phone/i.test(userAgent)) { 
     return "Windows Phone"; 
    } 

    if (/android/i.test(userAgent)) { 
     return "Android"; 
    } 

    // iOS detection from: http://stackoverflow.com/a/9039885/177710 
    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { 
     return "iOS"; 
    } 

    return "unknown"; 
}</script> 

<script> 
function DetectAndServe(){ 

if (getMobileOperatingSystem() == "Android") { 
    window.location.href = "http://www.Androidexample.com"; 
    } 
if (getMobileOperatingSystem() == "iOS") { 
    window.location.href = "http://www.IOSexample.com"; 
    } 
if (getMobileOperatingSystem() == "Windows Phone") { 
    window.location.href = "http://www.WindowsPhoneexample.com"; 
    } 
if (getMobileOperatingSystem() == "unknown") { 
    window.location.href = "http://www.NowherLandexample.com";} 
}; 
</script> 
</head> 
<body onload="DetectAndServe()"> 
</body> 
</html>