SureLock stands out with a dynamic feature set, allowing seamless hiding or unhiding of applications directly triggered by third-party apps.This dynamic capability ensures a tailored and secure user experience. SureLock not only transforms your device into a secure kiosk but also empowers it with intelligent application visibility control.
Purpose
The purpose of this article is to provide a guide to hide or unhide applications within SureLock using the AIDL (Android Interface Definition Language) method. We could achieve the same with SureLock settings which requires an Admin to provide\disclose the SureLock setting password. In order to avoid this, one could utilize the API commands integrated with third party apps to call out the hide\unhide features within the SureLock.
Prerequisites
- Only functions with Integrated SureLock.
- Ensure SureLock has the necessary permissions and is set as the default Home screen.
- The application that is allowed on the SureMDM console should also be allowed inside the SureLock.
Steps
Android’s AIDL mechanism is used to action requests from third-party apps for hiding and unhiding apps from the SureLock Home screen. SureLock listens to the service action from third-party applications and only authorizes those requests. The third-party application must be allowed on the SureMDM Console for SureLock to authorize requests. There are basically two steps to achieve the functionality
Step 1: Integrate the third party application with the API Code
Sample Code to be integrated with the third party application is as listed below:
Warning: The size of packagenameList, classnameList, and hideIconList should be the same. If it mismatches, the API will fail.
- Below is the interface to use
package com.nix;
interface IGears42SDK {
String sendAPICommandsForSureLock(in Bundle bundle);
}
- Below is the code to establish a connection with Gears42SDKservice
Intent intent = new Intent (IGears42SDK.class.getName()):
intent.setPackage(“com.nix”);
intent.setAction(“gears42.sdk”);
intent.setClassName(“com.nix”,"com.nix.Gears42SDKService”);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
1BoolResult=CustomApplication.getAppContext().bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE);
- Below is the code to send an API command to hide and unhide applications.
public class ClientComponent {
private IGears42SDK mIGears42Sdk;
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
mIGears42Sdk= IGears42SDK.Stub.asInterface(iBinder);
try {
Bundle.bundle=new Bundle();
bundle.putString(“command”,"hideorShowapplication”);
bundle.putStringArrayList(“packageNameList”, packagenamelist);//List of application packageName
bundle.putStringArrayList(“classNameList”,classnamelist);//List of application ClassName
bundle.putBooleanArray(“hideiconList”,hideIcon);//List of application visibility state.
} catch (RemoteException e) {
}
String result= mIGears42Sdk.sendAPICommandsForSureLock(bundle);
}
@Override
public void onServiceDisconnected(ComponentName componentName){
//Your disconnection logic here
}
};
}
Step 2: Approve the third party app from the console
To allow the third-party apps in the SureMDM console, please follow the steps below.
- Login to SureMDM > Settings > Account Settings > Device Properties > Approved Apps.
- On Add Application, you need to enter the App name, Package name of the application, and Signature Key Hash for your application.
NOTE: Developers should be able to find\provide the Signature Key Hash for the application. One easy way to find the Signature Key Hash is to navigate to the SureMDM console’s Apps section and look for a column Signature Key Hash if the device has the application already installed.
3. You need to check “I Agree” to allow SureMDM Agent to share Custom Property Data including the PII, with this approved application. For more information, please check out our privacy policy.
4. Click on Add.
In conclusion, following the above steps would enable a Third party application to utilize the AIDL mechanism to hide\unhide applications within SureLock. SureLock’s dynamic hide\unhide functionality, driven by requests from third-party apps, enhances both security and the user experience on your device.
Need help? CONTACT US