Public Sub StartInstall As Boolean
Dim success As Boolean
If IsDownloaded Then
Dim fileName As String = $"${ID}.apk"$
If File.Exists(Provider.SharedFolder, fileName) Then
Try
Dim i As Intent
Dim phone As Phone
If phone.SdkVersion >= 24 Then
Log(Provider.GetFileUri(fileName))
i.Initialize("android.intent.action.INSTALL_PACKAGE", Provider.GetFileUri(fileName))
i.Flags = Bit.Or(i.Flags, FLAG_GRANT_READ_URI_PERMISSION)
Else
Provider.SetFileUriAsIntentData(i, fileName)
i.SetType("application/vnd.android.package-archive")
End If
StartActivity(i)
success = True
installStatus = INSTALL_STARTED
Catch
Log($"Error starting install for application id ${ID} Exception information: ${LastException}"$)
End Try
Else
Log($"Downloaded APK for application id ${ID} cannot be found"$)
End If
Else
Log($"APK for application id [${ID}] must be downloaded first"$)
End If
If Not(success) Then
installStatus = INSTALL_FAILED
End If
Return success
End Sub