2016-02-16 110 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>