B4A Library [icefairy333]RootCmd library

this demo is show you how to install an apk in silent method (need root),and you can use it the execute other command:D
demo code
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim rc As RootCmd
   Dim btninstall As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   btninstall.Text="Install Apk"
End Sub
Sub btn_Click
   If rc.haveRoot Then
      File.Copy(File.DirAssets,"testapk.apk",File.DirRootExternal,"testapk.apk") 'copy to sdcard because the assets dir is readable only this application
      If rc.InstallApk(File.DirRootExternal&"/testapk.apk") Then
         Msgbox("install ok","success")
         Msgbox("install error","error")
      End If
      Msgbox("there is no root!","need Root")
   End If
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Author: IceFairy333
Version: 1
  • RootCmd
    • InstallApk (apkAbsolutePath As String) As Boolean
      install apk in silent mode(need root)
    • execRootCmd (cmd As String) As String
    • execRootCmdSilent (cmd As String) As Int
    • haveRoot As Boolean
by the way the library is in the zip

If you have benefitted from my work a contribution would be welcome


  • srcdemo.zip
    104.5 KB · Views: 875
Last edited: