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?
Edit: 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]);
}
}
I simply wait a bit, if the app hasn't launched, I open it in the browser on Android.
Also, the normal YouTube link sometimes asks if you want to open it in the app, not all the time which is quite annoying.
Edit: 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.
Edit: 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.