You CAN NOT do it for the first installation. At least i think this is not possible without user interaction. Means; User need to download the apk and run the Packageinstaller with the apk to install it. Note if he (the user) download the app using an email app (reading a mail with a attachment) then the emailapp needs to have the rights to install 3rd party apps.
The Code from the tutorial above only applies to UPDATES which is done by the app itself.