Module responsible for monitoring the installed applications that the user has in their device.
To be able to start the monitoring of applications user has installed, your application needs the user’s permission, as shown below:
final Activity activity = this;
MDMCore.askPermissionFullDialog(this, new MDMCore.PermissionListener() {
@Override
public void onPermissionResponse(boolean response) {
if (response && !MDMAppBehavior.hasAskedPermission(getApplicationContext())) {
MDMAppBehavior.setPermission(getApplicationContext(), true);
MDMAppBehavior.start(activity.getApplicationContext());
} else {
if (!MDMAppBehavior.hasPermissionToRun(getApplicationContext()) &&
!MDMAppBehavior.hasAskedPermission(getApplicationContext())) {
MDMAppBehavior.askPermission(activity);
}
}
}
});
In case you want to customize the permission request text that is displayed to the user, use the customized method as shown below:
final Activity activity = this;
MDMCore.askPermissionFullDialog(this, new MDMCore.PermissionListener() {
@Override
public void onPermissionResponse(boolean response) {
if (response && !MDMAppBehavior.hasAskedPermission(getApplicationContext())) {
MDMAppBehavior.setPermission(getApplicationContext(), true);
MDMAppBehavior.start(activity.getApplicationContext());
} else {
if (!MDMAppBehavior.hasPermissionToRun(getApplicationContext()) &&
!MDMAppBehavior.hasAskedPermission(getApplicationContext())) {
MDMAppBehavior.askPermissionCustom(activity,
"Custom Title", "Custom Message",
"Positive Button", "Negative Button", "More Info", "https://hands.com.br/politica-de-privacidade-de-dados.php");
}
}
}
});
To help users adhere, a functionality that presents data from the applications that the user has on their device was created.
This functionality can be implemented as shown below:
startActivity(new Intent(getApplicationContext(), MDMAppbehaviorActivity.class));