There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended. I am trying to launch my app by a URL from any other app like web browser,initially my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my app.
It gets started when a matching link is clicked not when you type the url in the browser. Try it by sending yourself an email containing http://ebay.com and click the link in the email application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With