Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a link open an Instagram page in an app installed on android?

I need to know how to make a link open an Instagram page in an app if the app is installed on a smartphone.

A simple way such as www.instagram.com/example links you to page by browser, which is not what I want.

How do I achieve this?

like image 578
Ardavan ZM Avatar asked Mar 25 '15 07:03

Ardavan ZM


People also ask

How do I open a link in a specific app Android?

To do that go to Settings -> Apps -> scroll down to the app that you don't want URLs to open in -> Tap on 'Open by Default' and select always Ask. So next time you click on a url it won't open in any app directly it will ask you and you choose it to open in Chrome.

How do I get my Instagram link on my Android phone?

1. Simply open your personal Instagram profile by clicking your username in the upper-right corner of the page. 2. At the top of the page, in your browser's address bar, is your profile URL.


4 Answers

It worked for me.

try {
    // mediaLink is something like "https://instagram.com/p/6GgFE9JKzm/" or 
    // "https://instagram.com/_u/sembozdemir"
    Uri uri = Uri.parse(mediaLink);
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);

    intent.setPackage("com.instagram.android");
    startActivity(intent);
} catch (ActivityNotFoundException e) {
        Log.e(TAG, e.getMessage());
}
like image 57
sembozdemir Avatar answered Oct 23 '22 10:10

sembozdemir


Try this :

Works 100% <a href="instagram://user?username=untitled.tiff">untitled.tiff</a>

like image 32
undefinedtoken Avatar answered Oct 23 '22 10:10

undefinedtoken


Launching instagram from the browser. To launch instagram form a link it should be enough to provide a link as:

<a href="http://instagram.com/p/<picture id>">look at this instagram picture</a>

example: look at this instagram picture

<a href="http://instagram.com/p/0nUyKnMJw4">look at this instagram picture</a>

Try opening that link on an android device. Also, keep in mind instagram must be installed on the device. For users replace the "p" with "_u" and the picture id with the username.

Why will this work? The instagram application has an intent listener for http and https browses

<data android:host="instagram.com" android:pathPrefix="/p/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/p/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_u/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_u/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_uid/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_uid/" android:scheme="https"/>
<data android:host="instagram.com" android:pathPrefix="/_n/" android:scheme="http"/>
<data android:host="instagram.com" android:pathPrefix="/_n/" android:scheme="https"/>

Edit: It apears I had an old Manifest file.

like image 29
Robbe Roels Avatar answered Oct 23 '22 11:10

Robbe Roels


You can open by android intent on browser anchor link. You can get detailed information here

<a href="intent://instagram.com/#Intent;package=com.instagram.android;scheme=https;end">Open Instagram</a>
like image 44
Krrish Yadav Avatar answered Oct 23 '22 10:10

Krrish Yadav