gpt4 book ai didi

android - 无法在 android 中使用 intent 打开 Linkedin 配置文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:19:52 25 4
gpt4 key购买 nike

如何使用 intent 打开 linkedin 个人资料:

我的代码:

context.getPackageManager().getPackageInfo(APP_PACKAGE_NAME, 0);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("linkedin://profile/" + profileID));
intent.setPackage(APP_PACKAGE_NAME);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

日志:

12-10 19:18:49.363     936-2104/? I/ActivityManager﹕ START u0 {act=android.intent.action.VIEW dat=linkedin://profile/132778900 pkg=com.linkedin.android cmp=com.linkedin.android/.infra.deeplink.DeepLinkHelperActivity} from pid 8392
12-10 19:18:49.373 1223-1377/? E/﹕ no predefined limited group find for com.linkedin.android, add to foreground group
12-10 19:18:49.463 7964-7964/? I/CrashReporter﹕ Starting activity DeepLinkHelperActivity Intent: Intent { act=android.intent.action.VIEW dat=linkedin://profile/132778900 pkg=com.linkedin.android cmp=com.linkedin.android/.infra.deeplink.DeepLinkHelperActivity }
12-10 19:18:49.493 7964-7964/? E/com.linkedin.android.deeplink.helper.LaunchHelper﹕ urlParams was null, indicating a failure to validate the path in getMap()
12-10 19:18:59.523 7964-7996/? D/LinkedInNetwork﹕ Performing request
12-10 19:19:04.573 1619-1666/? I/XiaomiFirewall﹕ firewall pkgName:com.linkedin.android, result:0

最佳答案

public void openLinkedInPage(String linkedId) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("linkedin://add/%@" + linkedId));
final PackageManager packageManager = getContext().getPackageManager();
final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.isEmpty()) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.linkedin.com/profile/view?id=" + linkedId));
}
startActivity(intent);
}

关于android - 无法在 android 中使用 intent 打开 Linkedin 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34203865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com