Giải pháp: API 11 là cần thiết xem câu trả lời bên dưới!thông báo biến mất - Android DownloadManager
Câu hỏi dễ dàng: Sau khi tải xuống tệp có tệp DownloadManager được triển khai, Thông báo sẽ biến mất. Làm cách nào để buộc Thông báo ở lại sau khi Tải xuống?
Tôi cố gắng để sử dụng VISIBILITY_VISIBLE_NOTIFY_COMPLETED, nhưng tôi không biết làm thế nào tôi có thể sử dụng nó
Thank cho bất kỳ loại giúp đỡ để giải quyết vấn đề này;)
EDIT: Mã
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 đăng một số mã để tắt. Thnx – CelticParser
Bạn cũng sử dụng API nào? –
@malger, bạn có quản lý để giải quyết vấn đề này không? Thông báo của tôi cũng biến mất. –