0

I want to launch my application if user click on a web link in another application and if user wants to open that link with my application.I used following 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:scheme="http"/>
            <data android:scheme="https"/>
            <data android:host="www.google.com"/>
 </intent-filter> 

But if user click on that link in another application that application is opening activity of my application in that application itself but i want to launch that activity in my application.

For example

suppose there is a link in hangouts like www.google.com if user click on that link it will show some apps to open in that if user select my app then it has to launch my application but it is launching my application activity in hangouts app itself without launching my app.

Please help me to solve this issue,Thanks in advance.

Nagaraju V
  • 2,636
  • 1
  • 11
  • 19
  • what do you mean 'launching activity in that application'? explain a little – Shreyans Mar 18 '16 at 11:55
  • suppose there is a link in hangouts like www.google.com if user click on that link it will show some apps to open in that if user select my app then it has to launch my application but it is launching my application activity in hangouts app itself without launching my app. – Nagaraju V Mar 18 '16 at 12:03
  • this might help you http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser – Kartheek Mar 21 '16 at 05:42
  • @Kartheek Its not working. – Nagaraju V Mar 21 '16 at 12:33

2 Answers2

0

Try this on event onClick:

Intent it = new Intent(Intent.ACTION_VIEW);
it.setData(Uri.parse("http://www.google.com.br"));
startActivity(it);
Pang
  • 8,605
  • 144
  • 77
  • 113
0

Try this:

Intent i=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.stackoverflow.com"));
startActivity(i);
Pang
  • 8,605
  • 144
  • 77
  • 113
Palani kumar
  • 119
  • 1
  • 10