问题
I want my app to download an apk file from a website through download manager when a button is clicked and want to show the prompt to install when the download is finished. Is it possible to do that? If yes, then how?
Currently I'm using
downloades = (Button) findViewById(R.id.downloades);
downloades.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=<package_name>"));
startActivity(intent);
}
});
to open the app in Google Play for the user to download it. But I want to download the APK file from a website (for an instance Mediafire) and prompt the user to install the app. Any solutions for it?
来源:https://stackoverflow.com/questions/49591966/how-to-use-download-manager-to-download-an-apk-from-a-website-and-then-show-prom