The developers should check the value of CanRequestPackageInstalls in Activity_Resume.
Sorry, but this one seems to add confusion to me.
My code in post#5 is modelled on your InstallAPK where nothing is in Activity_Resume while all the action is started in Button1_Click
Sub Button1_Click
Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
If Result Then
SendInstallIntent
End If
End Sub
I basically did the same, using BtnInstall_Click
Sub btnInstall_Click
Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
If Result Then
apkupdt.InstallApk 'send out command; async result in update_UpdateComplete
Else
Log("No permission to install")
End If
End Sub
Only difference is that,
once the check is ok you call directly SendInstallIntent while I have it buried in my class because I'd like to retun a status code in update_UpdateComplete. To serve entirely its scope, I should call apkupdt.InstallApk(Result) passing the result of the check, causing my class to return back the proper status code.
BTW, since there happen to be nothing dangerous in subs CanRequestPackageInstalls and CheckNonMarketAppsEnabled, these could be made part of the class as public subs called by code in CheckInstallationRequirements from Main. This way only the latter would be a requirement for the programmer to be included in his/her code.
If you still see problems with the above, could you kindly show some example code? I could even send you a preliminary copy of my lib (that will be published as source anyway) so you can have a look at it. Let me know.
TIA