How to obtain application context from broadcast receiver?

前端 未结 2 1126
广开言路
广开言路 2021-01-11 10:46

I have an extension of the Application class that I need to obtain reference in a BroadcastReceiver I have created. The context passed into the \"onReceive\" is a restricted

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 11:19

    BroadcastReceiver already gives the context. Look at the onReceive.

    public void onReceive(Context context, Intent intent)
    

提交回复
热议问题