Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - can i open Instagram app on given hashtag?

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.

like image 342
cyborg86pl Avatar asked Apr 14 '14 10:04

cyborg86pl


1 Answers

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.

like image 101
kodartcha Avatar answered Sep 27 '22 17:09

kodartcha