Android Question [SOLVED]HttpUtils2 help w/ possible need for intents

Tyler

Member
Licensed User
Hey, I'm stuck on this bit of code.

B4X:
Case DialogResponse.POSITIVE
  Activity.RemoveAllViews
    Activity.LoadLayout("Main")  
    http.Initialize("http", Me)
    http.Download("http://blank.com/blank.apk")      
End Select
    End If
End Sub


Sub JobDone (Job As HttpJob)
    If Job.Success == True Then
    Dim out As OutputStream
out = File.OpenOutput(File.DirDefaultExternal,"blank.apk",False )
'File.Copy2(http.GetInputStream, out)
File.Copy2(Job.GetInputStream, out)

    http.Release
    out.Close
    ToastMessageShow("Downloaded!", False)
  
    Else
    http.Release
  
    ToastMessageShow("Download failed.", False)
    End If
End Sub

As far as I can tell the code is correct, but the .apk file is nowhere to be found. I do see the "downloaded!" toast message however. Also, once I have the .apk file, how can I have android use the default(or prompt for default) app to open it(ie. package installer)?


Thanks very much, any help is greatly appreciated!!
 
Last edited:

Tyler

Member
Licensed User
Thanks for your reply!

The '==' operator seems to work elsewhere, also the 'True' condition appears to be being met as the corresponding ToastMessage shows correctly. And that lib would work except I'm hoping to do this with multiple file types at some points, not only apk's. Which is why I need it to be using the default app(or prompt).

EDIT: I tried with only the '=' operator with no luck:(
 
Last edited:
Upvote 0

Tyler

Member
Licensed User
Ahh yes, my apologies, pasted from elsewhere and didn't realize it wasn't going to root anymore. I believe I have also solved my other issue with

B4X:
i.Initialize(i.ACTION_VIEW, "file://" & File.DirDefaultExternal & "/713-042124-001.pdf")
i.SetType("application/pdf")
StartActivity(I)




Thanks for your help!!!
 
Upvote 0

DonManfred

Expert
Licensed User
I believe I have also solved my other issue with
most probably as the files folder of your app is not accessible by other applications.
 
Upvote 0
Top