I want to run async task in onReceive(Context context, Intent intent) method. now i want to use context of OnReceive….because i have to use : Cursor cursor = context.getContentResolver().query(); for getting the cursor so its throwing null pointer exception if I use context defined globally..so how to take context of Onreceive() method for running it asynch task inside it.
I want to run async task in onReceive(Context context, Intent intent) method. now i
Share
Simply create a global
Contextin theBroadCastReceiverand assign theContextinstance inside theonReceive()to this global Context instance and use it,