Skip to content

Commit

Permalink
Use PendingIntentCompat
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jul 18, 2024
1 parent 480925d commit a070797
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<application
android:name=".DemoApplication"
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.PendingIntentCompat;

import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadQueueSet;
Expand Down Expand Up @@ -195,9 +196,10 @@ private NotificationItem(int id, String title, String desc, String channelId) {
intents[0] = Intent.makeMainActivity(
new ComponentName(DemoApplication.CONTEXT, MainActivity.class));
intents[1] = new Intent(DemoApplication.CONTEXT, NotificationSampleActivity.class);
final PendingIntent pendingIntent = PendingIntent.getActivities(
final PendingIntent pendingIntent = PendingIntentCompat.getActivities(
DemoApplication.CONTEXT, 0, intents,
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT,
false);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder = new NotificationCompat.Builder(
Expand Down

0 comments on commit a070797

Please sign in to comment.