Android廣播接收器注冊問題:Causedby:java.lang.Ille - 新聞資訊 - 雲南小程序開發|雲南軟件開發|雲南網站建設-昆明融晨信息技術有限公司

159-8711-8523

雲南網建設/小程序開發/軟件開發

知識

不(bù)管是(shì)網站,軟件還是(shì)小程序,都要(yào / yāo)直接或間接能爲(wéi / wèi)您産生價值,我們在(zài)追求其視覺表現的(de)同時(shí),更側重于(yú)功能的(de)便捷,營銷的(de)便利,運營的(de)高效,讓網站成爲(wéi / wèi)營銷工具,讓軟件能切實提升企業内部管理水平和(hé / huò)效率。優秀的(de)程序爲(wéi / wèi)後期升級提供便捷的(de)支持!

您當前位置>首頁 » 新聞資訊 » 技術分享 >

Android廣播接收器注冊問題:Causedby:java.lang.Ille

發表時(shí)間:2021-1-10

發布人(rén):融晨科技

浏覽次數:93


1、程序中明明使用如下方法進行了(le/liǎo)廣播的(de)注冊和(hé / huò)解除注冊:
mContext.registerReceiver(downloadReceiver, filter);
mContext.unregisterReceiver(downloadReceiver);

但程序運行過程中還是(shì)有一下問題:
android.app.IntentReceiverLeaked: Activity *********** has leaked IntentReceiver *********** that was originally registered here. Are you missing a call to unregisterReceiver()?

并出(chū)現報錯:
Caused by: java.lang.IllegalArgumentException: Receiver not registered: ***************

後來(lái)改成下面方法就(jiù)可以(yǐ)了(le/liǎo):
mContext.getApplicationContext().registerReceiver(downloadReceiver, filter);
mContext.getApplicationContext().unregisterReceiver(downloadReceiver);

相關案例查看更多