|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.feedhenry.sdk.FH
public class FH
The FH class provides static methods to initialize the library, create new instance of all the API request objects and configure global settings.
Field Summary | |
---|---|
static java.lang.String |
APP_APIKEY_KEY
|
static java.lang.String |
APP_CONNECTION_TAG_KEY
|
static java.lang.String |
APP_HOST_KEY
|
static java.lang.String |
APP_ID_KEY
|
static java.lang.String |
APP_MODE_KEY
|
static java.lang.String |
APP_PROJECT_KEY
|
static int |
LOG_LEVEL_DEBUG
|
static int |
LOG_LEVEL_ERROR
|
static int |
LOG_LEVEL_INFO
|
static int |
LOG_LEVEL_NONE
|
static int |
LOG_LEVEL_VERBOSE
|
static int |
LOG_LEVEL_WARNING
|
static java.lang.String |
USER_AGENT_TEMP
|
static java.lang.String |
VERSION
|
Method Summary | |
---|---|
static FHActRequest |
buildActRequest(java.lang.String pRemoteAction,
JSONObject pParams)
Deprecated. |
static FHAuthRequest |
buildAuthRequest()
Build an instance of FHAuthRequest object to perform authentication request. |
static FHAuthRequest |
buildAuthRequest(java.lang.String pPolicyId)
Build an instance of FHAuthRequest object to perform authentication request and set the auth policy id |
static FHAuthRequest |
buildAuthRequest(java.lang.String pPolicyId,
java.lang.String pUserName,
java.lang.String pPassword)
Build an instance of FHAuthRequest object to perform authentication request and set the auth policy id, user name and passowrd |
static FHCloudRequest |
buildCloudRequest(java.lang.String pPath,
java.lang.String pMethod,
org.apache.http.Header[] pHeaders,
JSONObject pParams)
Build an instance of FHCloudRequest object to call cloud APIs |
static void |
cloud(java.lang.String pPath,
java.lang.String pMethod,
org.apache.http.Header[] pHeaders,
JSONObject pParams,
FHActCallback pCallback)
Call cloud APIs asynchronously. |
static java.lang.String |
getCloudHost()
Get the cloud host after app finish initialising |
static JSONObject |
getDefaultParams()
Get the default params for customised HTTP Requests. |
static org.apache.http.Header[] |
getDefaultParamsAsHeaders(org.apache.http.Header[] pHeaders)
Similar to getDefaultParams , but return HTTP headers instead |
static int |
getLogLevel()
Get the current log level for the FH library |
static java.lang.String |
getUserAgent()
Get the customized user-agent string for the SDK |
static void |
init(android.content.Context pContext,
FHActCallback pCallback)
Initialize the application. |
static boolean |
isOnline()
|
static boolean |
isReady()
Check if FH is ready |
static void |
setLogLevel(int pLogLevel)
Set the log level for the library. |
static void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String APP_HOST_KEY
public static final java.lang.String APP_PROJECT_KEY
public static final java.lang.String APP_CONNECTION_TAG_KEY
public static final java.lang.String APP_ID_KEY
public static final java.lang.String APP_APIKEY_KEY
public static final java.lang.String APP_MODE_KEY
public static final int LOG_LEVEL_VERBOSE
public static final int LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_INFO
public static final int LOG_LEVEL_WARNING
public static final int LOG_LEVEL_ERROR
public static final int LOG_LEVEL_NONE
public static final java.lang.String USER_AGENT_TEMP
public static final java.lang.String VERSION
Method Detail |
---|
public static void init(android.content.Context pContext, FHActCallback pCallback)
FH.init(this, new FHActCallback() {
public void success(FHResponse pRes) {
//pRes will be null for init call if it succeeds, don't use it to access response data
FHActRequest request = FH.buildActRequest("readData", new JSONObject());
request.executeAsync(new FHActCallback(){
public void success(FHResponse pResp){
//process response data
}
public void fail(FHResponse pResp){
//process error data
}
})
}
public void fail(FHResponse pRes) {
Log.e("FHInit", pRes.getErrorMessage(), pRes.getError());
}
});
pContext
- your application's contextpCallback
- the callback function to be executed after the initialization is finishedpublic static boolean isOnline()
public static void stop()
public static boolean isReady()
@Deprecated public static FHActRequest buildActRequest(java.lang.String pRemoteAction, JSONObject pParams) throws FHNotReadyException
FHNotReadyException
public static FHAuthRequest buildAuthRequest() throws FHNotReadyException
FHNotReadyException
public static FHAuthRequest buildAuthRequest(java.lang.String pPolicyId) throws FHNotReadyException
pPolicyId
- the auth policy id used by this auth request
FHNotReadyException
public static FHAuthRequest buildAuthRequest(java.lang.String pPolicyId, java.lang.String pUserName, java.lang.String pPassword) throws FHNotReadyException
pPolicyId
- the auth policy id used by this auth requestpUserName
- the required user name for the auth requestpPassword
- the required password for the auth request
FHNotReadyException
public static FHCloudRequest buildCloudRequest(java.lang.String pPath, java.lang.String pMethod, org.apache.http.Header[] pHeaders, JSONObject pParams) throws java.lang.Exception
pPath
- the path of the cloud APIpMethod
- currently supports GET, POST, PUT and DELETEpHeaders
- headers need to be set, can be nullpParams
- the request params, can be null
java.lang.Exception
public static java.lang.String getCloudHost() throws FHNotReadyException
FHNotReadyException
public static JSONObject getDefaultParams() throws java.lang.Exception
getDefaultParamsAsHeaders
method to add them as HTTP request headers.
java.lang.Exception
public static org.apache.http.Header[] getDefaultParamsAsHeaders(org.apache.http.Header[] pHeaders) throws java.lang.Exception
getDefaultParams
, but return HTTP headers instead
pHeaders
- existing headers
java.lang.Exception
public static void cloud(java.lang.String pPath, java.lang.String pMethod, org.apache.http.Header[] pHeaders, JSONObject pParams, FHActCallback pCallback) throws java.lang.Exception
pPath
- the path to the cloud APIpMethod
- currently supports GET, POST, PUT and DELETEpHeaders
- headers need to be set, can be nullpParams
- the request params, can be null. Will be converted to query strings depending on the HTTP methodpCallback
- the callback to be executed when the cloud call is finished
java.lang.Exception
public static void setLogLevel(int pLogLevel)
LOG_LEVEL_ERROR
. Please make sure this is set to LOG_LEVEL_ERROR
or LOG_LEVEL_NONE
before releasing the application.
The log level can be one of
pLogLevel
- The level of logging for the FH librarypublic static int getLogLevel()
public static java.lang.String getUserAgent()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |