In the code below, getcontentresolver() is null, but works in the onCreate() Service, but not in the function in the service. What for?
final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; final String[] cursor_cols = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA }; final String where = MediaStore.Audio.Media.IS_MUSIC + "=1"; cursor = getContentResolver() .query(uri, cursor_cols, where, null, null);
source share