1

I writed a simple Android application and added a intent filter like this:

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

Now, when I click by link from another application (like GMail) i see a dialog: choose application for run: MyApp or Browser.

But when I type this URL in browser's address bar it just open a site.

How can set up my app like a Google Play, Google+, flipkart? (When I type a http://play.google.com/ - i see a dialog Google Play App or Browser)

varun bhardwaj
  • 1,492
  • 13
  • 23
  • hey @varun did you get this.. I am in the same page and looking for a good solution. If you did before, kindly help me to do as well by giving a piece of code. Thanks. – Muthu S Nov 12 '19 at 17:41

2 Answers2

1

Its all about Broadcasts and Intents! The idea is that your app declares in the manifest that it can receive certain messages.

From this answer:

Basically, what you'll need to do is define your own scheme. Something along the lines of:

<intent-filter>
    <data android:scheme="anton" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" /> <--Not positive if this one is needed
    ...
</intent-filter>

Then you should be able to launch your app with links that begin with the anton: URI scheme.

Community
  • 1
  • 1
Joaquin Iurchuk
  • 5,003
  • 1
  • 40
  • 61
  • @joaquin I dont want a custom url I just want to open my app from browser if user types my website url. Same as if you type www.flipkart.com and you have that app in your phone then your phone browser will open flipkart app – varun bhardwaj Apr 21 '15 at 05:47
-1

add this source into manifest file

Adding the following fixed the issue:

So the intent filter looks like:

<intent-filter>
            <action android:name="android.intent.action.VIEW"></action>
            <category android:name="android.intent.category.DEFAULT"></category>
            <category android:name="android.intent.category.BROWSABLE"></category>
            <data android:host="example.com"> </data>
            <data android:scheme="https"></data>
            <data android:pathPattern=".*"></data>
</intent-filter>
Imtiyaz Khalani
  • 1,915
  • 14
  • 30