Android Question Will I have to like how can I find my downloaded apk?

borland

Member
Licensed User
Longtime User
I want to automatically install my downloaded apk, please help me, my English is not good, Thank you


Sub Process_Globals
Private link1 As String = "http://192.168.1.26:8091/ckplayer/download/cjxyplayer.apk"
End Sub

Sub Globals
Dim ProgressBar1 As ProgressBar
Dim Label1 As Label
Dim btnDownload As Button
Dim btnCancel As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub

Sub btnDownload_Click
Dim dd As DownloadData
dd.url = link1
dd.EventName = "dd"
dd.Target = Me
CallSubDelayed2(DownloadService, "StartDownload", dd)
End Sub

Sub dd_Progress(Progress As Long, Total As Long)
ProgressBar1.Progress = Progress / Total * 100
Label1.Text = NumberFormat(Progress / 1024, 0, 0) & "KB / " & _
NumberFormat(Total / 1024, 0, 0) & "KB"
End Sub

Sub dd_Complete(Job As HttpJob)
Log("Job completed: " & Job.Success)
Log("Job completed: " &Job.JobName)
Job.Release
End Sub

Sub btnCancel_Click
CallSubDelayed2(DownloadService, "CancelDownload", link1)
End Sub
 

vampirbcn

Active Member
Licensed User
Longtime User
You should use intent

with this code in the sub dd_Complete can run the installer
B4X:
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal,"cjxyplayer.apk"))
Intent1.SetType("application/vnd.android.package-archive")
StartActivity(Intent1)

Excuse my bad English
 
Upvote 0

borland

Member
Licensed User
Longtime User
You should use intent

with this code in the sub dd_Complete can run the installer
B4X:
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal,"cjxyplayer.apk"))
Intent1.SetType("application/vnd.android.package-archive")
StartActivity(Intent1)

Excuse my bad English
Thank you, but prompt resolution packet error, can not be installed
 
Upvote 0
Top