When I open the Android's default browser I want to add a button or a menu entry when it's clicked to open my Intent and pass me the current url parameter.
Is this possible in Android?
When I open the Android's default browser I want to add a button or a menu entry when it's clicked to open my Intent and pass me the current url parameter.
Is this possible in Android?
Only by means of the Share option, if the browser in question has one. The standard AOSP Browser app will have such a "Share" option in the action overflow. It triggers an ACTION_SEND
Intent
, with a MIME type of text/plain
, so any activities claiming to support that in the manifest via an <intent-filter>
will be able to respond:
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="text/plain"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Of course, you can get the current url:
URL url = new URL(mWebView.getUrl());
I don't know if I understood this right, but I think this what you want.
When the user clicks your button, you can redirect to a custom url, somesite://current_page_url.
using javascript or the addon's capability.
That can be picked up by your intent filter with host set to "somesite", as done here.