6

I'm working on an app that i have already published in the App Store, now making an Android build. In the iOS i simply use an uri like this one:

instagram://tag?name=myHashtag

It opens Instagram app, showing a grid of photos corelated with the hashtag. Unfortunately, in the android, below code doesn't work:

Intent hashtagIntent = new Intent(Intent.ACTION_VIEW,
        Uri.parse("instagram://tag?name=myHashtag")
);
startActivity(hashtagIntent);

Is there any method that would make this work? It's not any core feature of the app, so i don't want use Instagram's API.

cyborg86pl
  • 2,597
  • 2
  • 26
  • 43

1 Answers1

5

I worked a bit with instagram before and what I figured out is how to open certain pic or profile in app. But as long as there is no link on the instagram website for hashtags I don't know how to totally help you. In any case, this is how you open a pic on Instagram app from another app:

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

Change the link for http://instagram.com/_u/USER to open a user's profile.

Hope it helps.

Alex K
  • 8,269
  • 9
  • 39
  • 57
kodartcha
  • 1,063
  • 12
  • 23
  • thank you, now i'm sure it cannot be done this way. hope Instagram will become more open to Android devs – cyborg86pl Apr 14 '14 at 12:22
  • For this to work for opening a user, I had to change the link to http://instagram.com/_u/USER... – Alex K Feb 09 '15 at 20:25