Skip to content

Commit

Permalink
Fix Music Service on Android 11+
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowofleaf96 authored May 9, 2022
1 parent b4e2137 commit 193bdfa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/naman14/timber/MusicService.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class MusicService extends Service {
private static final int IDLE_DELAY = 5 * 60 * 1000;
private static final long REWIND_INSTEAD_PREVIOUS_THRESHOLD = 3000;
private static final String[] PROJECTION = new String[]{
"audio._id AS _id", MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,
BaseColumns._ID, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.ALBUM_ID,
MediaStore.Audio.Media.ARTIST_ID
Expand All @@ -160,15 +160,15 @@ public class MusicService extends Service {
MediaStore.Audio.Albums.LAST_YEAR
};
private static final String[] NOTIFICATION_PROJECTION = new String[]{
"audio._id AS _id", AudioColumns.ALBUM_ID, AudioColumns.TITLE,
BaseColumns._ID, AudioColumns.ALBUM_ID, AudioColumns.TITLE,
AudioColumns.ARTIST, AudioColumns.DURATION
};
private static final Shuffler mShuffler = new Shuffler();
private static final int NOTIFY_MODE_NONE = 0;
private static final int NOTIFY_MODE_FOREGROUND = 1;
private static final int NOTIFY_MODE_BACKGROUND = 2;
private static final String[] PROJECTION_MATRIX = new String[]{
"_id", MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,
BaseColumns._ID, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.ALBUM_ID,
MediaStore.Audio.Media.ARTIST_ID
Expand Down

1 comment on commit 193bdfa

@shadowofleaf96
Copy link
Author

@shadowofleaf96 shadowofleaf96 commented on 193bdfa May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is A fix for this error "Invalid column audio_id as _id" as a big changes in Android 11 breaks a lot of functions

Please sign in to comment.