22

For example, I get an email from Pinterest with interesting links for the week. When I click a pin, it opens in Chrome and not in the Pinterest app. This happens with a few apps and was wondering if there's a way to "open link with" type of feature.

Is it possible to force the links to open in their respective application and not in the default browser (e.g. Chrome)?

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
user26671
  • 221
  • 1
  • 2
  • 3

6 Answers6

13

Apps can request that links be opened using the app, using an API called an "intent filter".

If the app has the correct intent filter, you will be prompted to open the link using that app, and the app will then do something with it.

This has to be coded in by the app developer, and there is no way to implement it yourself unless you decompile the app and add it in.

An example of an app that does this is the Google+ app.

Dan Hulme
  • 35,000
  • 17
  • 90
  • 155
Liam W
  • 8,436
  • 11
  • 40
  • 67
  • 2
    More examples include: Twitter, Google Maps, Foursquare. So it completely depends on the app developers. – ale Jan 15 '13 at 20:06
  • 2
    I find it strange that the Gmail app isn't doing that. For instance: on Chrome on Android, click on recent tab showing an email on Chrome desktop; it would make sense in that case to open that email in the Gmail app. – avernet Nov 12 '14 at 18:46
  • Please could you provide some documentation or further information regarding intent filter? Thanks a lot you'll probably get a lot more credit for this answer, very helpful. – 1984 Mar 24 '19 at 00:03
6

This helper app makes Facebook, Twitter, Instagram, GitHub, and Goodreads links open in their apps instead of the browser: Open Link in App

It doesn't yet support Pinterest, but if you're technical, it's easy to add new apps, and doesn't require writing code! Details in the GitHub repo.

ryan
  • 170
  • 1
  • 7
2

If the links were opening in Chrome by default, all I had to do was, go to Settings -> Apps -> Set as default, choose the Chrome app and hit Clear defaults.

Next time when I clicked the link, the phone asked me to Open with with only two options: Chrome & Samsung Internet Browser. When I choose Chrome then Just once, once again the Open with came up but this time with 3 options: Pinterest, Chrome & Samsung Internet Browser. I chose Pinterest followed by Always and that is it.

Not sure why but this worked.

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
Jeena
  • 21
  • 1
  • I don't use Pinterest, but I might have a guess that the first link is a shortened/compact URL that is not recognized by the Pinterest app, then the browser redirects to the link that is now recognized by the Pinterest app, hence the additional option on the 2nd link. (further info on how this works is on existing answer) – Andrew T. Feb 15 '19 at 21:38
1

If you can get the APK, then you can open it in JADX [1]:

jadx-gui com.pinterest-10098030.apk

and check the Androidmanifest.xml file:

<intent-filter android:autoVerify="true">
   <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
   <action android:name="android.intent.action.VIEW"/>
   <category android:name="android.intent.category.DEFAULT"/>
   <category android:name="android.intent.category.BROWSABLE"/>
   <data android:scheme="https"/>
   <data android:scheme="http"/>
   <data android:host="www.pinterest.com"/>
   <data android:host="post.pinterest.com"/>
   <data android:host="pin.it"/>
   <!-- ... -->
</intent-filter>

So only link with those host will get noticed by the app. In addition, some apps also filter on the path:

<intent-filter android:label="@string/app_name" android:autoVerify="true">
   <data android:scheme="https" android:host="www.pbs.org"/>
   <data android:pathPattern="/video/.*/"/>
</intent-filter>

Finally, if you have adb, you can use it like this:

adb shell am start -d https://www.pbs.org/video/american-horses-i5v309/
  1. https://github.com/skylot/jadx
Zombo
  • 1
  • 14
0

In general, you can't do it. The reason behind the links opening in a browser is that they use the same protocols of normal web links. So if the particular app is not a browser, the links have to be opened with a browser app.

But you may have seen some links (particularly links to Android apps on the market) can be opened with the Android Market/Google Play Store app. This is possible because those links use market:// in their links rather than typical http://

If you need to confirm it, try clearing the defaults of your Chrome browser. It will make you choose an app to open a link when you click them. This will give you an open link with option (of course, to use the browser apps)

To do this, go to Settings -> Apps and select the Chrome app. Scroll to the bottom and find a clear defaults button and click it.

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
Sid
  • 4,176
  • 9
  • 35
  • 60
  • 4
    This isn't actually true. An app can register an intent to open any URL, even if it uses http. For example, the Play Store app will handle http://play.google.com/store/apps/details?id=foo links, as well as market:// links. – Dan Hulme Jul 09 '13 at 22:36
-1

JUST REMOVE http:// or https:// bofore URL and Enjoy!

  • 1
    Is this specifically for Pinterest? Are you sure it will work? Browsers will usually add http:// automatically if the input looks like a URL, so it won't really change anything. – Andrew T. Jul 01 '21 at 14:09
  • 1
    This won't work for a link - as the question requires - as that will already have the protocol prefix included within it. – Chenmunka Jul 01 '21 at 18:11