Intent to open Instagram user profile on Android

后端 未结 6 1615
清歌不尽
清歌不尽 2020-12-02 10:38

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 And

6条回答
  •  再見小時候
    2020-12-02 11:00

    I tried this way and it worked for me..

    instabtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
    
    
                    Intent instaintent = getActivity().getPackageManager().getLaunchIntentForPackage("com.instagram.android");
    
                    instaintent.setComponent(new ComponentName( "com.instagram.android", "com.instagram.android.activity.UrlHandlerActivity"));
                    instaintent.setData( Uri.parse( "https://www.instagram.com/_u/bitter_truth_lol") );
    
                    startActivity(instaintent);
    
                }
            });
    

提交回复
热议问题