Search code examples
android-intentandroid-browser

Android activity as a browser


I have an activity, which I want to make into a browser.
Which entries have to be made in the manifest.xml for this? I want the Activity to be also as target of URL-Intents like the other browsers such the standard browser or firefox or google chrome.

I am sorry for the very bad English, it is not my native tongue.


Solution

  • In your <activity> tag in the manifest, create an <intent filter> tag that includes a <data> tag containing a scheme and/or a host. This way, when the browser is opening your scheme://host it will ask the user if they want to use your app to view the link.

    Once your activity is opened, you can get the full url the user was opening by calling getIntent() in your Activity.

    http://developer.android.com/guide/topics/manifest/data-element.html