在应用而非浏览器中打开Youtube和Tumblr链接-Unity [英] Open Youtube and Tumblr link in app rather than browser - Unity
问题描述
我设法做到了,因此,当单击特定按钮时,它会使用fb://------
,twitter://----
和instagram://-----
加载Facebook,Twitter和Instagram,但是我似乎找不到用于YouTube或Tumblr的应用程序.有什么办法吗?
I've managed to make it so when clicking specific buttons it loads up Facebook, Twitter and Instagram using fb://------
, twitter://----
and instagram://-----
, but I can't seem to find one for YouTube or Tumblr. Is there any way to do this?
这是我当前的代码. (很抱歉回复缓慢)
This is my current code. (Sorry for the slow reply)
// 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的浏览器中将其打开.
I simply wait a bit, if the app hasn't launched, I open it in the browser on Android.
此外,普通的YouTube链接有时 询问您是否要在应用中打开它,而不是一直在烦人.
Also, the normal YouTube link sometimes asks if you want to open it in the app, not all the time which is quite annoying.
经过长时间的探索,我终于找到了它.
After searching for a hell of a long time, I finally found it.
tumblr://x-callback-url/blog?blogName=BLOGNAME
我将使用的社交媒体的完整列表是:
The full list of social media that I'll be using are:
fb://page/PAGEIDNUMBER
instagram://user?username=USERNAME
tumblr://x-callback-url/blog?blogName=BLOGNAME
twitter://user?user_id=USERID
https://youtube.com/user/USERNAME
将大写字母替换为您的特定页面.希望这对某人有帮助.
Replace the caps with your specific pages. Hope this helps someone.
推荐答案
编辑:搜索了很长时间的地狱之后,我终于找到了它.
After searching for a hell of a long time, I finally found it.
tumblr://x-callback-url/blog?blogName=BLOGNAME
我将使用的社交媒体的完整列表是:
The full list of social media that I'll be using are:
fb://page/PAGEIDNUMBER
instagram://user?username=USERNAME
tumblr://x-callback-url/blog?blogName=BLOGNAME
twitter://user?user_id=USERID
https://youtube.com/user/USERNAME
将大写字母替换为您的特定页面.希望这对某人有帮助.
Replace the caps with your specific pages. Hope this helps someone.
这篇关于在应用而非浏览器中打开Youtube和Tumblr链接-Unity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!