0

Suppose we have an activity to resolve external URL links with a specifix pathPrefix. It's not a problem. The problem is to have a method to make those links is only resolvable with my app. For example: We have this intent filter

<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="example.com" android:pathPrefix="/specific_prefix/" android:scheme="http" /> </intent-filter> 

And I want only my app to be used for example for "example.com/specific_prefix/etc". If that eve possible?

1
  • can you handle the host/path in the activity using java? Commented Jan 14, 2016 at 12:23

1 Answer 1

1

And I want only my app to be used for example for "example.com/specific_prefix/etc". If that eve possible?

No.

First, how URLs are interpreted is up to the app interpreting the URLs. Some Web browsers, when they encounter an http URL, will always handle it themselves, rather than seeing if a third-party app has advertised support for it.

Second, in cases where there are two or more apps that claim to support a certain operation, the user chooses which one to use. In your case, Web browsers and your app will claim to handle that URL, and the user can choose whichever of those that the user wants.

With Android 6.0's app links, you can avoid the chooser by default, so if a chooser would have appeared, the user will be taken straight to your app. The user can disable this in Settings, though.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I've seen this solution for 6.0 but this isn't suitable for us. If you have any another propositions or solutions I'll be really appreciate. The one goal we want to achieve is a possibility to open our app if it's present on a phone with some links, sent by sms or some socials. This is only solution I've found so if you have any tips please let me know.
@StanislavTimchenko: "The one goal we want to achieve is a possibility to open our app if it's present on a phone with some links, sent by sms or some socials" -- you already have this. Your question is not asking about how to do that. Your question is about how to force all other app developers and all users to always use your app for those links, and that is what you cannot do.
Yes, I know. My question was if there are any other ways to do so. And as I've understood - no. But thanks, now is all clear. I'll mark your question as accepted coz it is the only and the most suitable answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.