Android Question Install APK without User Intervention

Mike1970

Well-Known Member
Licensed User
Longtime User
hi everyone, it's possibile to make an app that install another apk WITHOUT user intervention?
I have to install this app (not on playstore) on a specific device of my property, and i need to update when i want.
So i need to be able to install an apk without click on "Install" prompt.
Thanks in advance!

I already see this posts:
- https://www.b4x.com/android/forum/threads/version-safe-apk-installation.87667/ (works well but asks for confirm)
- https://www.b4x.com/android/forum/t...tallation-auto-update-under-android-8.111004/ (i didn't understand what is the solution)
 

peacemaker

Expert
Licensed User
Longtime User
No.
1) Device must be rooted to install apk without manual user's confirmation
2) Or your app must be system: placed into "system/app" folder, or to be compiled and signed with the system key (that used for all system apps in ROM)
UPDATE:
3) The latest Android versions require the apk installation only from the folder "data/local/tmp" that is accesible if only ...
4) ... to have the SELinux security system setting set as "permissive" or fully "disabled". Here helped by the apk "SELinuxModeChanger"
 
Last edited:
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
No.
1) Device must be rooted to install apk without manual user's confirmation
2) Or your app must be system: placed into "system/app" folder, or to be compiled and signed with the system key (that used for all system apps in ROM)

Thanks for answering !
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
The requirements post is updated :(
I have a Samsung rooted device, it can be rebooted by the command line softwarely, but ... i could not setup it to install APK softwarely... i guess yet.

UPD: succeess :)

Code:
        Dim fs As Long = File.Size(dir, fn)
        Dim fullPathToApkFile As String = File.Combine(dir, fn)
        Dim comm As String = "cat $fullPathToApkFile | pm install -S $length".Replace("$fullPathToApkFile", fullPathToApkFile).Replace("$length", fs)
        Dim res As Boolean = Super_User(comm)
......
Sub Super_User(command As String) As Boolean
Dim su As SuShell

    If su.DeviceRooted Then
        Dim Process As SuProcess
        Process = su.Acquire("Su")
        If Process.Acquired Then
            Process.Execute(command)  
            Process.WaitForCompletion
            Log("Su.Success = " & Process.Success)
            Return Process.Success
        Else
            ToastMessageShow("Permissions error !", False)
        End If
    Else
        ToastMessageShow("Device not rooted !", False)
    End If
    Return False
End Sub
 
Last edited:
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
The requirements post is updated :(
I have a Samsung rooted device, it can be rebooted by the command line softwarely, but ... i could not setup it to install APK softwarely... i guess yet.

UPD: succeess :)

Code:
        Dim fs As Long = File.Size(dir, fn)
        Dim fullPathToApkFile As String = File.Combine(dir, fn)
        Dim comm As String = "cat $fullPathToApkFile | pm install -S $length".Replace("$fullPathToApkFile", fullPathToApkFile).Replace("$length", fs)
        Dim res As Boolean = Super_User(comm)
......
Sub Super_User(command As String) As Boolean
Dim su As SuShell

    If su.DeviceRooted Then
        Dim Process As SuProcess
        Process = su.Acquire("Su")
        If Process.Acquired Then
            Process.Execute(command) 
            Process.WaitForCompletion
            Log("Su.Success = " & Process.Success)
            Return Process.Success
        Else
            ToastMessageShow("Permissions error !", False)
        End If
    Else
        ToastMessageShow("Device not rooted !", False)
    End If
    Return False
End Sub
Actually I’m not in the “rooted world” yet, so this things are not 100% understandable to me 😂. But thanks for the moment! Very kind
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
 
Upvote 0
Top