2
  1. If I want to launch a specific activity of my app (A) from the other app (B), I can add [intent + bundle] in app (B) to make it happen. (Refer to)

  2. If I want to launch a specific activity of my app (A) form some URL, I can add [intent-filter + action + data] in app (A) to make it happen. (Refer to)

For 2nd purpose, how can I redirect the URL request to google play and download my app if the app isn't installed yet?

Is it possible to achieve the different purposes with the same URL?

Community
  • 1
  • 1
Indiana
  • 185
  • 3
  • 8
  • For users who doesn't install my app, my web server will redirect the url request to google play installing page. Now I can achieve both purposes in different situations with single URL. – Indiana Dec 27 '12 at 14:21

2 Answers2

0

Let's make it into a more real example, let's say App B reads from twitter and App A shows facebook posts, so you want facebook post URLs to open on App A.

From App B, before the user clicks on a facebook post URL, you can use the PackageManager to check if App A is installed or not, and in case it's not installed you pass app A Google Play url, else you just pass the facebook URL. Note that this will only work if the user is inside App B. It won't work if the user is on chrome for example.

But if the user don't have neither installed, there's nothing you can do.

Budius
  • 37,587
  • 15
  • 92
  • 134
0

You should use intent filters as Google mentions in its documentation, but there is a nicer and neat way to achieve navigation through urls (uris) using an AirBnb DeepLinkDispatch. Good luck!!

cesards
  • 14,087
  • 11
  • 63
  • 63