小编mal*_*ger的帖子

通知消失 - Android DownloadManager

解决方案:需要API 11,请参阅下面的答案!

简单问题:使用实施的DownloadManager下载文件后,通知消失.下载后如何强制通知保留?

我尝试使用VISIBILITY_VISIBLE_NOTIFY_COMPLETED,但我不知道如何使用它

感谢任何帮助解决这个问题;)

编辑:代码

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 …
Run Code Online (Sandbox Code Playgroud)

notifications android download notify download-manager

12
推荐指数
1
解决办法
9922
查看次数