Soluzione: è necessario l'API 11 vedere la risposta in basso!scompare - Android DownloadManager
Domanda facile: dopo aver scaricato un file con il DownloadManager implementato, la notifica scompare. Come posso forzare la notifica a rimanere dopo il download?
ho provato ad usare VISIBILITY_VISIBLE_NOTIFY_COMPLETED, ma non so come posso usarlo
Grazie per qualsiasi tipo di aiuto per risolvere questo problema;)
EDIT: Codice
public class BgDL extends Activity {
private DownloadManager mgr = null;
private long id;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
mgr = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request(Uri.parse(getIntent().getStringExtra("URL")));
id = mgr.enqueue(request
.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "UPDATE")
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI|DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false)
.setTitle("APP update")
.setDescription("New version "+getIntent().getDoubleExtra("OV", 0.0))
);
registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
BroadcastReceiver receiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(mgr.ACTION_DOWNLOAD_COMPLETE)){
unregisterReceiver(receiver);
finishActivity(99);
}
}
};
}
Plz invia un codice per uscire. Thnx – CelticParser
Anche quale API usi? –
@malger, sei riuscito a risolvere questo? Anche la mia notifica scompare. –