LSPosed API
Description
ILSPosedAPI is designed for managing LSPosed modules on an Android device within ZennoDroid. It allows you to enable/disable modules, manage the list of applications they apply to, and perform backups and restores.
Properties
ModuleName
-
string ModuleName { get; set; }
The name of the module.Description:
Specifies the module on which operations are performed. When the property is not set, the main ZennoDroid module is used.ZennoDroid works with three modules:
com.zennolab.zennodroid— the main ZennoDroid module, the default value;com.zennolab.zennovcam— ZennoVCam, the video substitution for the camera used by SetVideoForFakeCamera;com.zennolab.zennobackup— ZennoBackup, makes the encryption of the app data reversible so that the data can be moved between devices.
The module does not have to be installed in advance:
SetPackages,AddPackagesandRemovePackagesdeliver its apk to the device if it is not there yet.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.ModuleName = "com.zennolab.zennovcam"; // Work with the ZennoVCam module
lspHelper.SetPackages("com.example.app1"); // Set the scope list of the module
lspHelper.EnableModule(); // Enable the module
Methods
AddPackages
-
void AddPackages(params string[] packageNames)
Adds applications to which the module is applied.Parameters:
packageNames— array of application package names.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.AddPackages("com.example.app1", "com.example.app2"); // Add the apps to the scope list of the module
BackupAllModules
-
void BackupAllModules(string fileName)
Creates a backup of all modules.Parameters:
fileName— path to the archive: on the computer or, when it starts with/, on the device. The.gzextension is appended automatically.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.BackupAllModules(@"C:\lsposed\all_modules.gz"); // Save the archive on the computer
BackupModule
-
void BackupModule(string fileName)
Creates a backup of the current module's settings.Parameters:
fileName— path to the archive: on the computer or, when it starts with/, on the device. The.gzextension is appended automatically.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.ModuleName = "com.zennolab.zennovcam"; // The module whose settings are saved
lspHelper.BackupModule("/sdcard/Download/zennovcam.gz"); // Save the archive on the device
Close
void Close()
Closes the LSPosed interface.
Example
new LSPosedHelper(instance.DroidInstance).Close(); // Close the LSPosed interface
DisableModule
void DisableModule()
Disables the specified module.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.DisableModule(); // Disable the main ZennoDroid module
EnableModule
void EnableModule()
Enables the specified module.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.SetPackages("com.example.app1"); // The scope list is set before enabling
lspHelper.EnableModule(); // With an empty list the method fails with Add any package!
GetCLIStatus
-
string GetCLIStatus()
Gets the LSPosed status via CLI.Returns:
A string with status information (Android version, LSPosed version, device model).
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
return lspHelper.GetCLIStatus();
Open
void Open()
Opens the LSPosed interface.
Example
new LSPosedHelper(instance.DroidInstance).Open(); // Open the LSPosed interface
RemovePackages
-
void RemovePackages(params string[] packageNames)
Removes applications from the module's scope list.Parameters:
packageNames— array of package names.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.RemovePackages("com.example.app2"); // Take the app off the scope list of the module
RestoreAllModules
-
void RestoreAllModules(string fileName)
Restores all modules from a backup.Parameters:
fileName— path to the archive: on the computer or, when it starts with/, on the device. The.gzextension is appended automatically.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.RestoreAllModules(@"C:\lsposed\all_modules.gz"); // Restore every module from the archive on the computer
RestoreModule
-
void RestoreModule(string fileName)
Restores a module's settings from a file.Parameters:
fileName— path to the archive: on the computer or, when it starts with/, on the device. The.gzextension is appended automatically.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.ModuleName = "com.zennolab.zennovcam"; // The module whose settings are restored
lspHelper.RestoreModule("/sdcard/Download/zennovcam.gz"); // Restore from the archive on the device
SetPackages
-
void SetPackages(params string[] packageNames)
Sets the complete list of applications for the module (replaces the existing list).Parameters:
packageNames— array of package names.
Example
var lspHelper = new LSPosedHelper(instance.DroidInstance);
lspHelper.SetPackages("com.example.app1", "com.example.app2"); // Replace the scope list of the module
- Requirements:
- root access;
- LSPosed/Magisk installed.
- Module changes may require:
- restarting the application;
- or rebooting the device.
- Incorrect configuration may:
- cause application crashes;
- trigger a bootloop (in rare cases).