Skip to content

Commit

Permalink
fix: Targeting S+ version 31 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
devpolo committed May 25, 2022
1 parent 59719e2 commit e21bdfe
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -81,7 +81,12 @@ public MetadataManager(MusicService service, MusicManager manager) {
openApp.setAction(Intent.ACTION_VIEW);
openApp.setData(Uri.parse("trackplayer://notification.click"));

builder.setContentIntent(PendingIntent.getActivity(context, 0, openApp, PendingIntent.FLAG_CANCEL_CURRENT));
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
builder.setContentIntent(PendingIntent.getActivity(context, 0, openApp, PendingIntent.FLAG_IMMUTABLE));
}
else {
builder.setContentIntent(PendingIntent.getActivity(context, 0, openApp, PendingIntent.FLAG_CANCEL_CURRENT));
}

builder.setSmallIcon(R.drawable.play);
builder.setCategory(NotificationCompat.CATEGORY_TRANSPORT);
Expand Down

0 comments on commit e21bdfe

Please sign in to comment.