How can I access the database in a service in android? : public class BackServices  extends BroadcastReceiver {

    private boolean screenOff;

    @Override
    public void onReceive(Context context, Intent intent) {

        context.startService(new Intent(context, UpdateService.class));
        if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
            screenOff = true;
        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
            screenOff = false;
        }

                Intent i = new Intent(context, UpdateService.class);
                i.putExtra("screen_state", screenOff);
                context.startService(i);
            }

}
I need to access the database and collect the phone number from it how can I do that.