How to Use Download manager to download an apk from a website and then show prompt to install it?

假装没事ソ 提交于 2019-12-24 01:43:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!