| Applies to: |
| Product |
SureLock |
| Platform |
Android |
Surelock uses a BroadcastReceiver to allow 3rd party applications to send specific commands to SureLock. Commands can be send using Intent (See examples below). To execute any command, Administrator password is necessary.
SureLock API
exit_surelock – This command exits the device from lock down mode.
public synchronized void exitSurelock()
/* Intent Action MUST be 'com.gears42.surelock.COMMUNICATOR' */
final Intent intent = new Intent("com.gears42.surelock.COMMUNICATOR");
/* the command to execute is 'exit_surelock' */
intent.putExtra("command","exit_surelock");
/* optional parameter to identify the sender application */
intent.putExtra("sender", "com.gears42.test.kill_surelock");
/* SureLock's password. Command will NOT execute if password mismatches */
intent.putExtra("password", editText.getText().toString());
intent.setPackage("com.gears42.surelock");
this.sendBroadcast(intent);
intent.putExtra("command","apply_settings");
intent.putExtra("sender", context.getPackageName()); // optional intent.putExtra("password", surelockPassword);
intent.putExtra("setting_xml", surelockSettingFileContents);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","change_password");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.putExtra("new_password", newSureLockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","force_apply_settings");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.putExtra("settings_path", pathToSurelockSettingsFile);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","reset_idletimeout");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","activate");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("activation_code",activationcode);
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","deactivate");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","force_knox");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","hidebottombar");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("command","showbottombar");
intent.putExtra("sender", context.getPackageName()); // optional
intent.putExtra("password", surelockPassword);
intent.setPackage("com.gears42.surelock");
context.sendBroadcast(intent);
intent.putExtra("sender",context.getPackageName());
intent.putExtra("password",surelockPassword);
intent.putExtra("package_name",applicationPackageName);
intent.putExtra("label",applicationLabel); // optional
intent.putExtra("icon",applicationIcon); // optional
intent.putExtra("app_password",applicationPassword); // optional
intent.putExtra("hide_icon",True/False); // optional
intent.putExtra("launch_at_startup",True/False); // optional
intent.putExtra("restart_app_on_relaunch",True/False); // optional
intent.putExtra("clear_app_data",True/False); // optional
intent.putExtra("idle_timeout",value); // optional
intent.setPackage("com.gears42.surelock");
intent.putExtra("blocked_windows",childwindow1,childwindow2,childwindow3); // optional
intent.putExtra("landscape_position",0/1); // optional
intent.putExtra("portrait_position",0/1); // optional
intent.putExtra("command","remove_application");
intent.putExtra("sender",context.getPackageName());
intent.putExtra("password",surelockPassword);
intent.putExtra("package_name",applicationPackageName);
intent.setPackage("com.gears42.surelock");
intent.putExtra("command","wifi_settings");
intent.putExtra("sender",context.getPackageName());
intent.putExtra("password",surelockPassword);
intent.putExtra("ssid",wifiSSID);
intent.putExtra("wifi_password",wifiPassword);
intent.putExtra("security_type",securityType);
intent.setPackage("com.gears42.surelock");sendBroadcast(intent);
SureLock Command Line Options
Examples:
To add an application –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e password 0000 -e command add_application -e package_name -e label-e icon -e app_password <0000>-e hide_icon -e launch_at_startup -e restart_app_on_relaunch -e blocked_windows -e idle_timeout > com.gears42.surelock
To remove an application –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e password <0000> -e command remove_application -e package_name com.gears42.surelock
To configure Wi-Fi Settings –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e password <0000> -e command wifi_settings -e clear_saved_network -e ssid -e wifi_password -e security_type com.gears42.surelock
To change Password –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "change_password" -e "password" "0000" -e "new_password" "1111" com.gears42.surelock
To exit SureLock –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "password" "0000" -e "command" "exit_surelock" com.gears42.surelock
To force apply changes –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "force_apply_settings" -e "password" "0000" -e "settings_path" "/sdcard/SureLock.settings" com.gears42.surelock
To reset Idle Timeout –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "reset_idletimeout" -e "password" "0000" com.gears42.surelock
To activate SureLock License –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "activate" -e "password" "0000" -e "activation_code" "Enter Code Here" com.gears42.surelock
To deactivate SureLock License –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "deactivate" -e "password" "0000" com.gears42.surelock
To force the user to activate KNOX –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "password" "0000" -e "command" "force_knox" com.gears42.surelock
To hide bottom bar of the device –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "hidebottombar" -e "password" "0000" com.gears42.surelock
To show Bottom bar of the device –
am broadcast -a com.gears42.surelock.COMMUNICATOR -n com.gears42.surelock/com.gears42.surelock.service.SureLockCommunicator -e "command" "showbottombar" -e "password" "0000" com.gears42.surelock
To know more, visit https://www.42gears.com or contact us on info@42gears.com