我设法在点击特定按钮时使用fb://------
,twitter://----
和instagram://-----
来加载Facebook,Twitter和Instagram,但我可以'似乎找到一个YouTube或Tumblr。有没有办法做到这一点?
编辑:这是我目前的代码。 (对不起,回复很慢)
// Set buttontype in editor depending on which button it is
// 0 = facebook, 1 = instagram, 2 = tumblr, 3 = twitter, 4 = youtube
public int buttonType;
// Web urls - use this for computers or if the user doesn't have the app installed on phones
private string[] webUrls = {
"https://www.facebook.com/-------",
"https://www.instagram.com/--------",
"http://--------.tumblr.com/",
"https://twitter.com/----------",
"https://youtube.com/user/--------"
};
// Use this for android - loads the app - if don't have the app, default to weburls
private string[] appUrls = {
"fb://page/--------",
"instagram://user?username=---------",
"http://-------.tumblr.com/",
"twitter://user?user_id=-------",
"https://youtube.com/user/--------"
};
void OnMouseDown()
{
// Checks which device it's running on - STANDALONE is windows/mac/linux
#if UNITY_STANDALONE
Application.OpenURL (webUrls[buttonType]);
#endif
#if UNITY_ANDROID
Application.OpenURL (appUrls[buttonType]);
// Do a check to see if they have the app installed
StartCoroutine(CheckApp());
launchedApp = false;
#endif
}
// If switched app, set to true so it won't launch the browser
void OnApplicationPause()
{
launchedApp = true;
}
IEnumerator CheckApp()
{
// Wait for a time
yield return new WaitForSeconds (waitTime);
// If app hasn't launched, default to opening in browser
if(!launchedApp)
{
Application.OpenURL (webUrls[buttonType]);
}
}
我只是稍等一下,如果该应用尚未启动,我会在Android上的浏览器中打开它。
此外,正常的YouTube链接有时会询问您是否要在应用中打开它,而不是一直非常烦人。
编辑:在寻找了很长一段时间后,我终于找到了它。
tumblr://x-callback-url/blog?blogName=BLOGNAME
我将使用的社交媒体的完整列表是:
fb://page/PAGEIDNUMBER
instagram://user?username=USERNAME
tumblr://x-callback-url/blog?blogName=BLOGNAME
twitter://user?user_id=USERID
https://youtube.com/user/USERNAME
用您的特定页面替换大写字母。希望这有助于某人。
答案 0 :(得分:2)
编辑:在寻找了很长一段时间后,我终于找到了它。
tumblr://x-callback-url/blog?blogName=BLOGNAME
我将使用的社交媒体的完整列表是:
fb://page/PAGEIDNUMBER
instagram://user?username=USERNAME
tumblr://x-callback-url/blog?blogName=BLOGNAME
twitter://user?user_id=USERID
https://youtube.com/user/USERNAME
用您的特定页面替换大写字母。希望这有助于某人。
答案 1 :(得分:0)
使用youtu.be/LINK
for youtube可以打开用户,频道和视频链接。
希望它有助于某人:)