Commit 111eb8b6 by Kim Jinsung

Android12で起こったPendingIntentエラー対応

parent bc3f70a2
...@@ -152,8 +152,12 @@ public class BackgroundDownloadService extends Service { ...@@ -152,8 +152,12 @@ public class BackgroundDownloadService extends Service {
} }
private Notification getNotification(int uniqueId, Intent intent, String message, boolean isImportanceLow) { private Notification getNotification(int uniqueId, Intent intent, String message, boolean isImportanceLow) {
PendingIntent pendingIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
pendingIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
return new Notification.Builder(this) return new Notification.Builder(this)
.setDefaults(Notification.DEFAULT_ALL) .setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.drawable.icon) .setSmallIcon(R.drawable.icon)
......
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