B.B.
B.B.

Reputation: 954

Android URL intent deep linking like iOS

The iOS OS provides this back button on the top of an app that was opened via custom URL schemes. This button generally displays the name of the app that launched the custom URL scheme. This could be seen in the screenshot, "Return to Search". Search is the app that opened the app in foreground now.

iOS deep linking feature

I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.

NOTE - I know iOS do not have a back button, and hence this was developed. But displaying the app name, makes it explicit that my app was opened via URL intent by this app. It provides higher visibility to the users.

Upvotes: 1

Views: 1055

Answers (3)

Simon Marquis
Simon Marquis

Reputation: 7526

The is no way of doing it automatically, but:

Android API lvl 22 introduced a new method getReferrer() to return information about who launched this activity.
By default, it will return a android-app: referrer URI.
For instance, Chrome beta will use android-app//:com.chrome.beta as referrer when launching an app.
You could therefore use this value (it might not be 100% trusted) and query the package manager to get the application label.

Upvotes: 1

Ronaldo Felipe
Ronaldo Felipe

Reputation: 402

You can collect some data that manages user experience, but only in your own environment. For example N apps that interact with each other. If you think closely you will see that knowing who wakes your app up doesn't make sense since the caller can use a broadcast, for instance.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007359

I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.

No, insofar as you have no way of knowing who started your activity.

Upvotes: 1

Related Questions