Skip to content

Commit

Permalink
API adoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
fm-sys committed Jun 17, 2024
1 parent f6da513 commit 406e395
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/src/main/java/com/fmsys/snapdrop/QuickTileService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fmsys.snapdrop;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Build;
import android.service.quicksettings.Tile;
Expand Down Expand Up @@ -32,7 +34,21 @@ public void onClick() {
}
}

@SuppressLint("StartActivityAndCollapseDeprecated")
private void startSnapdrop() {
startActivityAndCollapse(new Intent(this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
final Intent intent = new Intent(this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(
PendingIntent.getActivity(
this,
0,
intent,
PendingIntent.FLAG_IMMUTABLE
)
);
} else {
startActivityAndCollapse(intent);
}
}
}

0 comments on commit 406e395

Please sign in to comment.