简体   繁体   English

如何从Android应用程序打开推特?

[英]How to open the twitter from android app?

I want to open a twitter page using a button from a game made in unity.我想使用统一制作的游戏中的按钮打开推特页面。 It should detect if the mobile twitter app is present on the device and if not open in web browser instead.它应该检测移动 twitter 应用程序是否存在于设备上,以及是否在网络浏览器中打开。

public void OpenTWTR()
{
        #if UNITY_ANDROID
            Application.OpenURL($"www.mobile.twitter.com/{TWTR_NAME}");

        #elif UNITY_EDITOR
            Application.OpenURL($"www.twitter.com/{TWTR_NAME}");
        #endif
}

Is there a better, more reliable way to do it?有没有更好、更可靠的方法来做到这一点?

希望这适用于 Android -

Application.OpenURL("twitter://user?screen_name=[user_name]");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM