BroadcastReceiver trying to return result during a non-ordered broadcast - PACKAGE_ADDED in Android

前端 未结 2 1640
忘了有多久
忘了有多久 2021-01-03 19:14

I am getting this exception in my below given code. i don\'t have any idea what is wrong with this code. Please help me out to get rid of this exception.

05-         


        
相关标签:
2条回答
  • 2021-01-03 19:53

    Delete setResultCode(). That is only for use with an ordered broadcast, as is described in the documentation for setResultCode().

    0 讨论(0)
  • 2021-01-03 20:04

    The clean way to fix it would be to do as follows:

    if (isOrderedBroadcast()) {
        setResultCode(Activity.RESULT_OK);
    }
    

    For reference: https://groups.google.com/forum/#!topic/android-gcm/0J_RBzTQFHs

    0 讨论(0)
提交回复
热议问题