是否存在类似于Soundcloud Uri(“ soundcloud:// users:” +“ soundcloud_username”)的内容,允许应用程序用户打开Tiktok应用程序并转到另一个用户页面,例如下面的Soundcloud代码?>
Soundcloud代码参考:强制在Android的Soundcloud应用中打开Soundcloud曲目
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://users:" + "soundcloud_username"));
startActivity(intent);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://soundcloud.com/"+string_soundcloudLink_profile)));
}
答案 0 :(得分:0)
嘿,我在xamarin.android中找到了解决方案
private void urlclick(object sender, EventArgs e)
{
PackageManager manager = PackageManager;
var U =Android.Net.Uri.Parse("http://vm.tiktok.com/tiktokulr");///Add URL of you tiktok account
Intent i;
Intent icheck;
try
{
i = new Intent(Intent.ActionView, U);
icheck = manager.GetLaunchIntentForPackage("com.zhiliaoapp.musically");
if (icheck == null)
{
Toast.MakeText(this, "please install tiktok in your phone", ToastLength.Short).Show();
throw new PackageManager.NameNotFoundException();
}
else
{
StartActivity(i);
}
}
catch (PackageManager.NameNotFoundException exp)
{
}
答案 1 :(得分:0)
private fun openTikTokProfile() {
val uri: Uri = Uri.parse("https://www.tiktok.com/@${username}")
val intent = Intent(Intent.ACTION_VIEW, uri)
intent.setPackage("com.zhiliaoapp.musically")
if (intent.resolveActivity(requireActivity().packageManager) != null) {
startActivity(intent)
}
}