I have a specific requirement where I have to fire a url on the browser from my activity. I am able to do this with the following code :
Intent browserIntent = new Intent(
Intent.ACTION_VIEW, Uri.parse(
pref.getString("webseal_sso_endpoint", "") + "?authorization_code="
+ code + "&webseal-ip=" + websealIP
)
);
activity.startActivity(browserIntent);
activity.finish();
Now, I want to invoke this webseal_sso_endpoint by passing an extra header. say ("user":"username") How can I implement this? Thanks a lot in advance!
I featured out how to add a header. Here is my code:
Recommended method to do this would be to use the Uri class to create your URI. Helps ensure that everything is defined correctly and associates the correct key to value for your URI.
For example, you want to send a Web intent with this URL:
And you have a defined URL and parameters you want to send, you should declare these as static final fields, like so:
You can then use these, like so:
Now if you want to add another parameter, add another appendQueryParameter, like so:
You can convert to a URL if needed using:
Should come out like this: