Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Instagram User Profile

I managed to open the Twitter and Facebook user profile from my app. But I can not find any references to Instagram.

Is There a way to open Instagram in order to show a user profile like in twitter or facebook?

For instance, in order to get the Intent to launch the twitter application I do:

public Intent getOpenTwitterIntent(Context context) {      try {         return new Intent(Intent.ACTION_VIEW,                 Uri.parse("twitter://user?screen_name="                         .concat(twitterUsername)));      } catch (Exception e) {         return new Intent(                 Intent.ACTION_VIEW,                 Uri.parse("https://twitter.com/#!/".concat(twitterUsername)));     }  } 

How can I achive something similar with Instagram? Thanks in advance.

like image 296
Blackbelt Avatar asked Mar 19 '13 10:03

Blackbelt


People also ask

How do I view someones Instagram profile?

The simplest way to find somebody on Instagram is to use the search function. This, of course, requires you to know their name or Instagram username. From the home screen, tap the magnifying glass-shaped Search button to open the search menu. Enter the user's username or name in the top Search field.

How can I see a Instagram account without logging in?

All you have to do when looking for an Instagram profile without an account is type the Instagram website URL in your browser followed by the account's username. For example, you can type in "www.instagram.com/[username]" and see the account's photo feed.

Can I see who opens my Instagram profile?

Instagram doesn't allow users to see who views their profile. So if you look through someone's profile and don't like or comment on a post, there's no way for them to know who sees the pictures.

How do you get someones Instagram URL?

Go to instagram.com/username. For example, if the username is "johnsmith," type in instagram.com/johnsmith as the URL. Click the post you want to save and copy the link at the top of your browser.


2 Answers

Here is a method to get the Intent to open the Instagram app to the user's profile page:

/**  * Intent to open the official Instagram app to the user's profile. If the Instagram app is not  * installed then the Web Browser will be used.</p>  *   * Example usage:</p> {@code newInstagramProfileIntent(context.getPackageManager(),   *     "http://instagram.com/jaredrummler");}</p>  *   * @param pm  *            The {@link PackageManager}. You can find this class through  *            {@link Context#getPackageManager()}.  * @param url  *            The URL to the user's Instagram profile.  * @return The intent to open the Instagram app to the user's profile.  */ public static Intent newInstagramProfileIntent(PackageManager pm, String url) {     final Intent intent = new Intent(Intent.ACTION_VIEW);     try {         if (pm.getPackageInfo("com.instagram.android", 0) != null) {             if (url.endsWith("/")) {                 url = url.substring(0, url.length() - 1);             }             final String username = url.substring(url.lastIndexOf("/") + 1);             // http://stackoverflow.com/questions/21505941/intent-to-open-instagram-user-profile-on-android             intent.setData(Uri.parse("http://instagram.com/_u/" + username));             intent.setPackage("com.instagram.android");             return intent;         }     } catch (NameNotFoundException ignored) {     }     intent.setData(Uri.parse(url));     return intent; } 
like image 74
Jared Rummler Avatar answered Sep 25 '22 13:09

Jared Rummler


So far I couldn't find a way to show user's profile directly.. but there is a way around..

Found this solution from Instagram Manifest from GitHub

 Intent iIntent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");  iIntent.setComponent(new ComponentName( "com.instagram.android", "com.instagram.android.activity.UrlHandlerActivity")); iIntent.setData( Uri.parse( "http://instagram.com/p/gjfLqSBQTJ/") );  startActivity(iIntent); 

This will open particular image post by the user in the app. From the page app user can open the profile with the link inside.

If you want to open recent post or something , you can use Instagram API

This is not we want exactly , but the better option now... i guess :)

like image 31
Dinesh Balu Avatar answered Sep 25 '22 13:09

Dinesh Balu