我尝试了将apk从当前版本升级到高级版本的不同代码。我从我的服务器下载了我的apk并尝试安装它。它已成功从服务器下载到我的手机,并显示一个替换应用程序的对话框。当我继续安装时,它显示安装,最后显示“应用程序未安装”并带有DONE按钮。
这是我测试过的代码
File file = new File(Environment.getExternalStorageDirectory()
.getPath(), "app_name.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
startActivity(intent);
我也尝试使用广播接收器。 他们都没有工作。
请帮我弄清楚这个问题。