Skip to main content

OtaNetApiUtil

class OtaNetApiUtil

Description: OTA network API interface tool class

method getInstance

public synchronized static OtaNetApiUtil getInstance()

Description: Instance or OtaNetApiUtil with single instance

Input parameters: None。

Output parameters: object of this class

Related parameters: None。

method isBuildTypeRelease

public static boolean isBuildTypeRelease()

Description: release package or debug package

Input parameters: None。

Output parameters: true or false

Related parameters: None。

method getSystemLocal

public static Locale getSystemLocal()

Description: Getting system's locale object

Input parameters: None。

Output parameters: locale object of device

Related parameters: None。

method isChina

public static boolean isChina(Locale currentCountry)

Description: Checking region chines or not

Input parameters: currentCountry: locale object passing

Output parameters: true or false

Related parameters: None。

method isLanguageChinese

public boolean isLanguageChinese(Locale locale)

Description: Checking language chines or not

Input parameters: locale: locale object passing

Output parameters: true or false

Related parameters: None。

method getProductName

public String getProductName(CheckResponseBean.Data data)

Description: Getting product name

Input parameters: data: response data object

Output parameters: return product name based ob country code

Related parameters: CheckResponseBean。

method getProductPkgDes

public String getProductPkgDes(CheckResponseBean.Data data)

Description: Getting product package description

Input parameters: data: response data object

Output parameters: return product package description based ob country code

Related parameters: None。

method getProductRemind

public String getProductRemind(CheckResponseBean.Data data)

Description: Getting product reminder`

Input parameters: data: response data object

Output parameters: return product reminder based ob country code

Related parameters: None。

method getLanguage

public static String getLanguage()

Description: Getting default language

Input parameters: None。

Output parameters: returning country code of language

Related parameters: None。

method generateQueryString

public synchronized  String generateQueryString()

Description: Query string generate

Input parameters: None。

Output parameters: string of query

Related parameters: None。

method generateSignString

public String generateSignString(String appId, String notice, String timestamp, String sKey)

Description: Generate sign string

Input parameters: appId: application id notice: notice timestamp: time stamp of file sKey: application key

Output parameters: None。

Related parameters: None。

method joinParamString

private String joinParamString(String appId, String notice, String timestamp)

Description: Joining params in string

Input parameters: appId: application id notice: notice timestamp: time stamp

Output parameters: params string

Related parameters: None。

method generateSignString

private String generateSignString(String message, String appKey)

Description: Generate sing string from message and application key

Input parameters: message: message appKey: application key

Output parameters: None。

Related parameters: None。

method hMacWithJava

String hMacWithJava(String data, String key)
throws NoSuchAlgorithmException, InvalidKeyException

Description: Create java value with mac

Input parameters: data: string data key: application key

Output parameters: return string data

Related parameters: NoSuchAlgorithmException,InvalidKeyException。

method getSalt

private String getSalt(int n)

Description: Get salt data with n size

Input parameters: n :size

Output parameters: Salt data passes

Related parameters: None。

method registerProduct

public void registerProduct(RegisterProductBean bean, CommonCallbacks.CompletionCallbackWithParam<ResultBean> callback, int retryCount)

*Description:** Product registration

Input parameters: bean: product registration parameter RegisterProductBean callback: callback for result bean retryCount: count value

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method checkProduct

public void checkProduct(CheckProductRequestBean bean, CommonCallbacks.CompletionCallbackWithParam<CheckResponseBean> callback, int retryCount)

Description: Product package upgrade check interface

Input parameters: bean: CheckProductRequestBean callback: callback for result response bean

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method checkApp

public void checkApp(CheckAppRequestBean bean, CommonCallbacks.CompletionCallbackWithParam<CheckResponseBean> callback, int retryCount)

Description: APP package upgrade check interface

Input parameters: bean: CheckAppRequestBean callback: callback for result response bean

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method reportProduct

public void reportProduct(ReportProdUpgStatusBean bean, CommonCallbacks.CompletionCallbackWithParam<ResultBean> callback, int retryCount)

Description: Report product

Input parameters: bean: ReportProdUpgStatusBean callback: callback for result bean

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method getIMEIDeviceId

public String getIMEIDeviceId(Context context)

Description: Obtain the device number of the mobile phone

Input parameters: context: context

Output parameters: device id

Related parameters: None。

method packageName

public String packageName(Context context)

Description: Package name get

Input parameters: context: the context

Output parameters: package name as string

Related parameters: None。

method packageCode

public int packageCode(Context context)

Description: Package code

Input parameters: context: the context

Output parameters: package code as integer

Related parameters: None。

method isNetworkConnected

public boolean isNetworkConnected(Context context)

Description: Checking internet connection

Input parameters: context: the context

Output parameters: status true and false

Related parameters: None。