MicroStrategy ONE
Pass Custom HTTP Headers for Android
Library Mobile SDK for Android allows you to add custom HTTP headers to each request. Customized request headers are useful for adding additional information in requests made by the Library Mobile client. An example would be adding special authentication information, such as authentication tokens from other authentication servers, to the headers of HTTP requests. These requests are sent to the MicroStrategy Library server.
Retrieve the CustomizedHttpHeader util class to access the dictionary that stores custom HTTP headers.
The following methods are exposed via the com.microstrategy.android.model.config.CustomizedHttpHeader class with related customized HTTP headers:
Return Type |
Method and Description |
---|---|
public static CustomizedHttpHeader |
sharedCustomizedHeader() This method returns the singleton instance of this class. |
public String[] |
getHttpHeaderFields() This method returns all network header keys. |
public String |
getValueForHttpHeaderField(String field) @param field The string of the customized HTTP header key. Provide a specific customized network header and return the value. |
public void |
removeValueForHttpHeaderField(String field) @param field The string of the customized HTTP header. Provide a specific customized network header to remove the item. |
public void |
setValueForHttpHeaderField(String value, String field) @param field The string of the customized HTTP header. @param value The value for the customized HTTP header you want to set. This is method is used to insert one item in a customized header dictionary. |
public void |
clearHttpHeaderFields() This method is used to clear all customized headers. |
Examples for Passing Custom Login Parameters
Use CustomizedHttpHeader singleton anywhere you want to store or update custom HTTP headers in your project.
CustomizedHttpHeader.sharedCustomizedHeader().setValueForHttpHeaderField("test","SM_USER");
You can add an extra HTTP header after a successful login in a custom login listener. See Customize the Login Process for Android to create a custom login listener and register it.