意图打开在Android Instagram的用户配置文件 [英] Intent to open Instagram user profile on Android

查看:232
本文介绍了意图打开在Android Instagram的用户配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个社交网络应用程序和我们的用户可以将他们的Instagram帐户连接到我们的服务。我想直接在自己的官方Android应用程序打开Instagram的配置文件(如果已安装),但我找不到任何办法做到这一点。然而,在他们的开发者网站有关iOS上完全相同的功能的页面但这似乎不工作Android上的。一切我在网上找到了唯一的建议不同的方法来打开一个浏览器链接。有什么建议?

I'm developing a social networking app and our users can connect their Instagram account to our service. I'd like to open Instagram profiles directly in their official Android app (if it is installed) but I can't find any way to do that. However, there is a page on their developer site about the exact same feature on iOS but this doesn't seem to work on Android at all. Everything I found on the web only suggests various ways to open links in a browser. Any suggestions?

推荐答案

我解决了这个问题,下面用code。

I was resolved this problem use following code.

    Uri uri = Uri.parse("http://instagram.com/_u/xxx");
    Intent likeIng = new Intent(Intent.ACTION_VIEW, uri);

    likeIng.setPackage("com.instagram.android");

    try {
        startActivity(likeIng);
    } catch (ActivityNotFoundException e) {
        startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("http://instagram.com/xxx")));
    }

这篇关于意图打开在Android Instagram的用户配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆