Knox Tizen Wearable SDK
License policy group

License policy group provides policies for device license control. More...

Functions

mdm_data_tmdm_activate_license (const char *pkg, const char *license_key)
 Asynchronous API to activate Enterprise license. More...
 
mdm_data_tmdm_activate_knox_license (const char *pkg, const char *license_key)
 Asynchronous API to activate Knox Enterprise license. More...
 
mdm_data_tmdm_deactivate_knox_license (const char *pkg, const char *license_key)
 Asynchronous API to deactivate Knox license. More...
 
mdm_data_tmdm_get_api_call_data (const char *pkg)
 API to retrieve API call data for the given packagename on device. More...
 

Detailed Description

License policy group provides policies for device license control.

License policy group.

Required Header

#include <mdm.h>

Overview

This group provides APIs to control the license of client.

Function Documentation

mdm_data_t* mdm_activate_knox_license ( const char *  pkg,
const char *  license_key 
)

Asynchronous API to activate Knox Enterprise license.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
This API is used to activate Knox license. Admin can use this API to activate Knox Enterprise license on device. Active/non-active admin can call this API. The final activation status will be notify asynchronously by the callback - MDM_CB_LICENSE_ACTIVATE_KNOX callback type. After the license activation the client application can be notify asynchronously about license validation - MDM_CB_LICENSE_KNOX_VALIDATE_RESULT callback type.
//
// License callback
//
void __license_callback_(int oper, void *cb_data, void *user_data)
{
switch(oper) {
case MDM_CB_LICENSE_ACTIVATE_KNOX:
if(ldata->license_info != NULL) {
// ...
} else {
// ...
}
break;
case MDM_CB_LICENSE_KNOX_VALIDATE_RESULT:
if(ldata->license_info != NULL) {
// ...
} else {
// ...
}
break;
default:
// ...
break;
}
}
int fun()
{
char license_key[] = "key";
// Connect to the MDM
// License callback registration.
mdm_register_client_callback(MDM_LICENSE_CB, __license_callback_, NULL, NULL);
mdm_data_t *lp_data = mdm_activate_knox_license(pkg_name, license_key);
if (lp_data != NULL) {
// mdm_get_license_info success
mdm_license_status_t *license_status = (mdm_license_status_t *)lp_data->data;
if(mdm_license_info_t != NULL) {
// ...
}
mdm_free_data(lp_data);
} else {
// mdm_get_license_info fail
}
}
Parameters
[in]pkgName of package
[in]license_keyKey to activate knox license
Returns
mdm_data_t * on success, NULL will be returned in error case.
See also
mdm_activate_license, mdm_deactivate_knox_license
mdm_data_t* mdm_activate_license ( const char *  pkg,
const char *  license_key 
)

Asynchronous API to activate Enterprise license.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can use this API to activate Enterprise license for the MDM client application. Active/non-active admin can call this API. The final activation status will be notify asynchronously by the callback - MDM_CB_LICENSE_ACTIVATE callback type. After the license activation the client application can be notify asynchronously about license validation status - MDM_CB_LICENSE_VALIDATE_RESULT callback type.
//
// License callback
//
void __license_callback_(int oper, void *cb_data, void *user_data)
{
switch(oper) {
case MDM_CB_LICENSE_ACTIVATE:
if(ldata->license_info != NULL) {
// ...
} else {
// ...
}
break;
case MDM_CB_LICENSE_VALIDATE_RESULT:
if(ldata->license_info != NULL) {
//
} else {
//
}
break;
default:
// ...
break;
}
}
int fun()
{
char license_key[] = "LicenseKey";
// Connect to the MDM
// License callback registration.
mdm_register_client_callback(MDM_LICENSE_CB, __license_callback_, NULL, NULL);
mdm_data_t *lp_data = mdm_activate_license(pkg_name, license_key);
if (lp_data != NULL) {
// Success
if (lp_data->ret == MDM_ERR_NONE) {
// Status OK
} else {
// Status Error
}
mdm_free_data(lp_data);
} else {
// Failure
}
return 0;
}
Parameters
[in]pkgPackage name of the MDM client application
[in]license_keyKey to activate license provided by the MDM client application
Returns
mdm_data_t * on success or NULL on error.
See also
mdm_activate_knox_license
mdm_data_t* mdm_deactivate_knox_license ( const char *  pkg,
const char *  license_key 
)

Asynchronous API to deactivate Knox license.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
This API is used to deactivate Knox license The final deactivation status will be notify asynchronously by the callback - MDM_CB_LICENSE_DEACTIVATE_KNOX type.
//
// License callback
//
void __license_callback_(int oper, void *cb_data, void *user_data)
{
switch(oper) {
case MDM_CB_LICENSE_DEACTIVATE_KNOX:
if(ldata->license_info != NULL) {
// ...
} else {
// ...
}
break;
default:
// ...
break;
}
}
int fun()
{
char license_key[] = "key";
// Connect to the MDM
// License callback registration.
mdm_register_client_callback(MDM_LICENSE_CB, __license_callback_, NULL, NULL);
mdm_data_t *lp_data = mdm_deactivate_knox_license(pkg_name, license_key);
if (lp_data != NULL) {
// mdm_get_license_info success
mdm_license_status_t *license_status = (mdm_license_status_t *)lp_data->data;
if(mdm_license_info_t != NULL) {
// ...
}
mdm_free_data(lp_data);
} else {
// mdm_get_license_info fail
}
}
Parameters
[in]pkgName of package
[in]license_keyKey to activate license
Returns
mdm_data_t * on success, NULL will be returned in error case.
See also
mdm_data_t* mdm_get_api_call_data ( const char *  pkg)

API to retrieve API call data for the given packagename on device.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:

Used to get the API call data as a key-value pair in JSONArray format as shown below: [{{ "log_date" :"DATE1" , "api_call" : {"API_1" : "CALLS_VALUE" , ... , "API_n" : "CALLS_VALUE"}}, {"log_date" :"DATE2" , "api_call" : {"API_1" : "CALLS_VALUE" , ... , "API_n" : "CALLS_VALUE"} }]

mdm_data_t *lp_data = mdm_get_api_call_data("com.example.app");
if (lp_data != NULL) {
// Success
if(lp_data->data != NULL) {
char *json = (char *)lp_data->data;
}
mdm_free_data(lp_data);
} else {
// Failure: invalid license rights
}
Parameters
[in]pkgThe package name of the Client application.
Returns
mdm_data_t * on success or NULL on error.
Permission:
Usage of this API is restricted by admin