public class PCSDK
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PCSDK.PCQRType
QR-code types to process by PCSDK
|
Modifier and Type | Field and Description |
---|---|
static int |
PC_LOG_DEBUG
Log level - debug logs to logcat
|
static int |
PC_LOG_KEY_VALUES
Log level - log key values to logcat.
|
static int |
PC_LOG_VERBOSE
Log level - log key values to logcat.
|
static int |
PC_NO_LOGGING
Log level - no logging
|
Modifier and Type | Method and Description |
---|---|
static PCSDK.PCQRType |
analyzeQRValue(java.lang.String qrValue)
Function to analyze data from scanned QR-code
Should be used to detect if PCSDK can process QR-code data |
static boolean |
areCallbacksInvokedInMainThread()
Returns the same value as was passed to last call of
setCallbacksInvokedInMainThread(boolean) or
true if this method was never called from the app. |
static boolean |
checkRoot()
Function to check if device is rooted
Returns true if root detected Does not checks if BusyBox presents |
static void |
clearCaches()
Used for clear caches
. |
static Context |
getContext()
Context given when calling
init(Context) |
static java.util.Map<java.lang.String,java.lang.String> |
getCustomHttpHeaders()
Custom headers which was set by last call of
setCustomHttpHeaders(Map) |
static long |
getRealTime()
Returns real rime provided by google server
|
static java.util.HashMap<java.lang.String,java.lang.String> |
getSpyAppsList()
Function to build list of potentially dangerous installed apps which include:
(1) Apps with PACKAGE_USAGE_STATS and SYSTEM_ALERT_WINDOW privileges excluding system apps
(2) Apps from predefined blacklist which might be dangerous Apps with privileges PACKAGE_USAGE_STATS and SYSTEM_ALERT_WINDOW can track active app name in any time and show it's own content over the top This ability is required to make overlay-attack Function excludes following apps: com.sec.android.easyMover com.google.android.apps.nbu.files |
static java.lang.String |
getVersion()
Returns PCSDK SDK version
|
static void |
init(Context context)
Lib initialization.
|
static boolean |
isInitialized()
Whether PCSDK is properly initialized
|
static void |
removeAllUsers()
Remove all users completely from a device and resets SDK state.
|
static void |
reset()
Resets all handles for all users and resets state.
|
static void |
setAlternativeLogger(AlternativeLogger logger)
Changes the way in which SDK writes log
|
static void |
setCallbacksInvokedInMainThread(boolean isInMainThread)
Defines whether the callbacks passed to various methods which involve interaction with server should be invoked
in main thread or not.
|
static void |
setCustomHttpHeaders(java.util.Map<java.lang.String,java.lang.String> customHttpHeaders)
Sets custom HTTP headers which are added to every query to PC External until new headers are set by next call of
this function
|
static void |
setFixedApiVersion(boolean isFixed)
Determines whether the API version for a particular
PCUser is fixed once it has been discovered.By default, the API version is not remembered between the sessions which means that every time before the new session with PC Server is established, the actual API version is being resolved. |
static void |
setHandlesBackgroundTimeout(int timeout)
Defines maximum period (in milliseconds), during which handles for private keys will be kept
while the app in the background.
|
static void |
setLogLevel(int logLevel)
Set PCSDK SDK log level
|
public static final int PC_NO_LOGGING
public static final int PC_LOG_DEBUG
public static final int PC_LOG_KEY_VALUES
public static final int PC_LOG_VERBOSE
public static void init(Context context)
context
- Application context. Required for access to Android services on behalf of Applicationpublic static void setAlternativeLogger(AlternativeLogger logger)
logger
- Implementation of AlternativeLogger
. Methods of this implementation will be called
instead of LogCat methods. If you pass null, the LogCat will be usedpublic static void reset()
init(Context)
needs to be called after this
method to continue working with SDKpublic static void removeAllUsers()
init(Context)
needs to be called
after this method to continue working with SDKpublic static long getRealTime()
public static void setCallbacksInvokedInMainThread(boolean isInMainThread)
init(Context)
in case you
intend to alter default behaviour.isInMainThread
- Pass true if you want callbacks to be invoked in main thread. Pass
false if you do not care about actual thread where callbacks will be
invoked. If false is passed callbacks will be executed either in separate thread (which
is created by SDK for interaction with server) or in the same thread where SDK method
is called in case the separate thread was not created (e.g. when there is no internet
connection and callback returns error of type
PCNetError.PCIS_ERROR_NO_CONNECTION
).public static boolean areCallbacksInvokedInMainThread()
setCallbacksInvokedInMainThread(boolean)
or
true if this method was never called from the app.public static boolean isInitialized()
public static void setLogLevel(int logLevel)
logLevel
- - log levelpublic static void setFixedApiVersion(boolean isFixed)
PCUser
is fixed once it has been discovered.isFixed
- true if API version must be fixed across the sessions with PC Server, false if
API version is supposed to be checked before every new sessionpublic static boolean checkRoot()
public static java.util.Map<java.lang.String,java.lang.String> getCustomHttpHeaders()
setCustomHttpHeaders(Map)
public static void setCustomHttpHeaders(java.util.Map<java.lang.String,java.lang.String> customHttpHeaders)
customHttpHeaders
- Map of custom HTTP headers (header name -> header value)public static java.util.HashMap<java.lang.String,java.lang.String> getSpyAppsList()
public static java.lang.String getVersion()
public static PCSDK.PCQRType analyzeQRValue(java.lang.String qrValue)
qrValue
- data from QR-codePCSDK.PCQRType
public static Context getContext()
init(Context)
public static void setHandlesBackgroundTimeout(int timeout)
timeout
- max time in milliseconds for being in background during which handles are keptpublic static void clearCaches()