public class TcrSdk
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
TcrRenderView |
createTcrRenderView(Context context,
TcrSession session,
TcrRenderView.TcrRenderViewType mode)
Create a rendering view for a session.
|
TcrSession |
createTcrSession(TcrSessionConfig cfg)
Create a session.
|
static TcrSdk |
getInstance()
Return The singleton of this class
|
static java.lang.String |
getPluginUrl()
Get the plugin download url for the light version TcrSdk.
|
void |
init(Context ctx,
java.lang.String pluginPath,
AsyncCallback<java.lang.Void> callback)
Initialize this TcrSdk.
|
void |
setLogger(TcrLogger logger)
Set a logger for the TcrSdk.
|
public static TcrSdk getInstance()
public void init(Context ctx, java.lang.String pluginPath, AsyncCallback<java.lang.Void> callback)
ctx
- The Android context. It should not be null
.pluginPath
- The local file path of the plugin for the lite version TcrSdk. null
if you
are using the full version TcrSdk.callback
- The callback for initialization result. It cannot be null
.AsyncCallback.onSuccess(Object)
method will be called if the initialization is
successful.AsyncCallback.onFailure(int, String)
method will be called if the initialization fails. The
error code of the callback refers to ERR_PLUGIN_DO_NOT_EXIST
,
ERR_PLUGIN_MD5_VERIFY_FAILED
, ERR_CREATE_DIRECTORY_FAILED
, ERR_EXTRACT_PLUGIN_FAILED
, ERR_INSTALL_PLUGIN_FAILED
.public TcrRenderView createTcrRenderView(Context context, TcrSession session, TcrRenderView.TcrRenderViewType mode)
The TcrRenderView.release()
method of the returned view should be called to release the underlying
resources if it is no longer used.
This method should only be called on UI Thread.
context
- The context of the return view. It cannot be null
.session
- The session that return view associates with. It cannot be null
.mode
- The type of the return view. It cannot be null
.null
maybe returned if creation fails due to the TcrSdk plugin
fails to be initialized.public TcrSession createTcrSession(TcrSessionConfig cfg)
The TcrSession.release()
method of the returned session should be called to release the underlying
resources if it is no longer used.
cfg
- The configuration of the session.null
maybe returned if creation fails due to the TcrSdk plugin fails to
be initialized.public void setLogger(TcrLogger logger)
By default, the TcrSdk will print logs to a temporary file on the sdcard as well as the android device logs.
If you set a custom logger
via this method, the TcrSdk will then only callback logs to your
logger
.
This method can be called before init(Context, String, AsyncCallback)
.
logger
- the TcrLogger object to be set. It should not be null
.public static java.lang.String getPluginUrl()
null
if in full version TcrSdk.