FireflyApi system settings
3.2 System settings
- System shutdown
Function:public void shutDown(boolean showConfirm)Description:System shutdownParameters:Does showConfirm display the shutdown boxExample:
- System restart
Function:public void reboot()Description:System shutdownExample:
- System hibernation
Function:public void sleep()Description:System shutdownExample:
- Screen capture
Function:public boolean takeScreenshot(String path,String name)Description:Take a screenshot and save it to the specified pathParameters:path storage pathname file stored name (available only in PNG format)Return: Whether a screenshot is successfully captured true/falseExample:
- Screen rotation
Function:public boolean setRotation(int rotation)Description:RotationScreen parameters:rotation Screen direction: Surface.ROTATION_0Surface.ROTATION_270Example:mFireflyApi.setRotation(Surface.ROTATION_0);
- Get the screen direction
Function:public int getRotation()Description:Get the screen directionReturn:rotation Screen direction: Surface.ROTATION_0Example:
- Cancel screen rotation
Function:public void thawRotation()Description:Cancel screen rotationExample:
- Display / hide status bar
Function:public void setStatusBar(boolean show)Description:Display / hide status barParameters:show is set to true, it means to display the status bar, otherwise, false to hide the status barExample:
- Backlight switch
Function:public void setLcdBackLight(boolean on)Description:Turns the backlight off without hibernating the device, the software still runsParameters:on is set to true, it means to turn on the backlight, otherwise, false to turn it offExample:
- Is there a backlight
Function:public boolean hasLcdBackLight()Description:Determine if there is backlightReturn:The value is set to true, it means there is backlight, or false for no backlight otherwiseExample:
- Set the screen brightness
Function:public boolean setBrightness(int brightness)Description:Set the screen brightnessParameters:brightness range 0-255Return:true on success, false on failureExample:
- Get screen brightness
Function:public int getBrightness()Description:Get screen brightnessReturn:screen brightness,returns -1 when the failure occursExample:
- Set system time
Function:public boolean setTime( int year, int month, int day, int hour,int minute,int second)Description:Set system timeParameters:yearmonthdayhourminutesecondReturn:true on success, false on failureExample:
- Silent installation
Function:public boolean silentInstall(String path)Description:Silent installationParameters:path apk addressReturn:true on successful installationExample:
- Silent uninstallation
Function:public boolean silentUnInstall(String package_name)Description:Silent uninstallationParameters:package name the application to be uninstalledReturn:Returns true if the app is uninstalled successfully, or false otherwiseRemark:Only supports apps installed manually, but not for built-in appsExample:
- Execute shell command
Function:public Command execCmd(String cmd)Description:Execute shell commandParameters:cmd shell commandReturn:Command input commandoutput resultsexitStatus shell running status, 0 is normal exitExample:
- su permission to run shell command
Function:public static Command execSuCmd(String cmd)Description:su permission to run shell commandParameters:cmd shell commandReturn:Command input commandoutput resultsexitStatus shell running status, 0 is normal exitExample:mFireflyApi.execSuCmd("cat init.rk30board.rc");//init.rk30board.rc Default permission 750
- Save system logcat
Function:public void saveLogcat(String folderPath,String fileName)Description:Grab the LOG message in the Android layer and save it to the corresponding directoryParameters:folderPath save pathfileName save file nameExample:
- Get Hdmiin current connection status
Function:public String getHdmiinStatus()Description:Get Hdmiin current connection statusReturn:STATUS_HDMI_IN_CONNECT="1" hdmiin connectedSTATUS_HDMI_IN_NO_CONNECT="0" hdmiin not connectedExample:
- Get the current number of screens
Function:public int getScreenNumber(Context context)Description:Get the current number of screensReturn:Returns 0 if it failsExample: