Commit 9d5a6fa0 authored by Erik Duisters's avatar Erik Duisters
Browse files

Fixed NPE when contentIntent is triggered

parent 024a084b
......@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
......@@ -308,10 +309,14 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
iOpenActivity.putExtra("deviceId", notificationDevice);
iOpenActivity.putExtra("player", notificationPlayer.getPlayer());
TODO: Remove when Min SDK >= 16
The only way the intent extra's are delivered on API 14 and 15 is by either using a different requestCode every time
or using PendingIntent.FLAG_CANCEL_CURRENT instead of PendingIntent.FLAG_UPDATE_CURRENT
PendingIntent piOpenActivity = TaskStackBuilder.create(context)
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
.getPendingIntent(Build.VERSION.SDK_INT > 15 ? 0 : (int)System.currentTimeMillis(), PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NotificationHelper.Channels.MEDIA_CONTROL);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment