Hi all, i'm having a small issue using an intent to install an updated apk file which gets downloaded from a server.
The apk gets downloaded just fine, i have verified that.
i receive the following error
I have searched the forums about this issue and found several posts that suggest the following code.
as you can see at the beginning of the logs, the size of the apk file is 12.7Mb, and the response code from the server is OK, I'am bothered at the fact that on the threads i've read, this code works for them, but i can't figure out why it won't work for me, is there anything i should be adding to the manifest file perhaps?
I'am using a service to download the apk file and i'am using the OKHttpUtils library, i'm using B4A version 6.8 on a samsung Galaxy Active tab SM-T360 running Android version 5.1.1
Any advice will be greatly appreciated guys.
Thanks,
Walter
The apk gets downloaded just fine, i have verified that.
i receive the following error
** Activity (main) Resume **
** Service (downloadupdate) Create **
** Service (downloadupdate) Start **
apk size: 12785167
response code: 200
true
main_installnewapk (B4A line: 759)
StartActivity(newintent)
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///storage/emulated/0/Download/Observer.apk typ=application/vdn.android.package-archive flg=0x20000 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1861)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1534)
at android.app.Activity.startActivityForResult(Activity.java:4124)
at android.app.Activity.startActivityForResult(Activity.java:4071)
at android.app.Activity.startActivity(Activity.java:4395)
at android.app.Activity.startActivity(Activity.java:4363)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:698)
at ifims.observer.main._installnewapk(main.java:3470)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
I have searched the forums about this issue and found several posts that suggest the following code.
B4X:
Sub InstallnewApk()
Dim newintent As Intent
newintent.Initialize(newintent.ACTION_VIEW, "file://"&File.Combine(File.DirRootExternal&"/Download", "Observer.apk"))
newintent.SetType("application/vdn.android.package-archive")
StartActivity(newintent)
End Sub
as you can see at the beginning of the logs, the size of the apk file is 12.7Mb, and the response code from the server is OK, I'am bothered at the fact that on the threads i've read, this code works for them, but i can't figure out why it won't work for me, is there anything i should be adding to the manifest file perhaps?
I'am using a service to download the apk file and i'am using the OKHttpUtils library, i'm using B4A version 6.8 on a samsung Galaxy Active tab SM-T360 running Android version 5.1.1
Any advice will be greatly appreciated guys.
Thanks,
Walter