我的应用程序在android API 24及更低版本上运行良好,但在API 25及更高版本上存在下载问题!
首次打开该应用程序时,会显示通知以从Internet下载文件。该问题发生在API 25及更高版本上,显示了通知,但文件未下载。
我试图通过将API级别和targetSdkVersion更新为28来修复它,我也查看了使用许可,但没有成功。
我需要你的建议。
Public class MainActivity extends Activity {
ImageView m,m2;
ImageButton v1,v2,v3,v4,v5;
private long backPressedTime = 0;
private ProgressDialog mProgressDialog;
final Context context = this;
String Url="https://www.dropbox.com/s/abc=1";
String unzipLocation = Environment.getExternalStorageDirectory() + "/QFolder/";
String StorezipFileLocation =Environment.getExternalStorageDirectory() + "/DownloadedZip";
String DirectoryName=Environment.getExternalStorageDirectory() + "/QFolder/files/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File f = new File(Environment.getExternalStorageDirectory()+"/QFolder/files/");
if(f.exists() == false)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setTitle("Download Now");
alertDialogBuilder
.setMessage(" File Size 75 MB")
.setCancelable(false)
.setNegativeButton("äÚã",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
new DownloadZipfile();
mew.execute(Url);
}
})
.setPositiveButton("..",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
}
}