B4X:
Case "downloadjob"
If HttpUtils.IsSuccess(downloadurl) Then
src=HttpUtils.GetInputStream(downloadurl)
'target=File.OpenOutput(File.DirDefaultExternal,"dj.apk",False)' if I use File.DirDefaultExternal then no install error.
'target=File.OpenOutput(File.DirInternalCache,"dj.apk",False)'
target=File.OpenOutput(File.DirInternal,"dj.apk",False)
File.Copy2(src,target)
target.Flush
target.Close
Dim i As Intent
'i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal,"dj.apk"))'NO ERROR
'i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirInternalCache,"dj.apk"))
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirInternal,"dj.apk"))'ERROR
i.SetType("application/vnd.android.package-archive")
StartActivity(i)
End If
Last edited: