Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using getContentResolver in BroadcastReceiver extended class

I have to use the getContentResolver method in a class that extends BroadcastReceiver and I found that getContentResolver can be used only in a class that extends Activity. I try to do a static method in a class that extends activity but i can't use getContentResolver in a static method. I also tried with a non-static method but when i run the appliaction I get an error. How can I do? Thanks!

like image 543
pindol Avatar asked Dec 06 '22 21:12

pindol


1 Answers

In your onReceive(Context, Intent) you receive a Context object which has a getContentResolver() Method.

like image 97
darune Avatar answered Apr 18 '23 14:04

darune