Dear Sir:
Attachment is my project use for down .apk file from server and savt to sd card,I have some problems as below:
(1)I got the sd card file path(Check my project)
if i used below code,then i can see the file in my phone's sd card path
my issue is when jobdown finish,I can't see tmp.apk file in my phone's sd card
(2) when i exe the code as below,i got parser error,it's cause of the file not exist in my sd card path or something miss?
Attachment is my project use for down .apk file from server and savt to sd card,I have some problems as below:
(1)I got the sd card file path(Check my project)
B4X:
/storage/extSdCard/Android/data/b4a.samples.downloadservice/files
B4X:
File.WriteString(Path,"Agree.txt","Agree")
B4X:
Sub JobDone (job As HttpJob)
Log("JobName = " & job.JobName & ", Success = " & job.Success)
ProgressDialogHide
If job.Success = True Then
Select job.JobName
Case "job2"
Log(Path)
If File.Exists(Path , "tmp.apk")=True Then
File.Delete(Path,"tmp.apk")
End If
MyStream = File.OpenOutput(Path, "tmp.apk", False)
MyStream.InitializeToBytesArray(1)
File.Copy2(job.GetInputStream,MyStream) ' save the file
Dim iIntent As Intent
iIntent.Initialize(iIntent.ACTION_VIEW, "File://" & Path & "/tmp.apk")
iIntent.SetType("application/vnd.android.package-archive")
StartActivity(iIntent)
End Select
End If
job.Release
End Sub
B4X:
Dim iIntent As Intent
iIntent.Initialize(iIntent.ACTION_VIEW, "File://" & Path & "/tmp.apk")
iIntent.SetType("application/vnd.android.package-archive")
StartActivity(iIntent)