Refactor @RequiresApi annotation on Notifications chananel creation
This commit is contained in:
parent
8ca50f2631
commit
95a03d58ce
|
@ -204,7 +204,7 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU)
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
@ -40,6 +41,7 @@ import es.ugr.swad.swadroid.utils.NotificationUtils;
|
|||
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
|
||||
*/
|
||||
public class AlertNotificationFactory {
|
||||
public static final String CHANNEL_NAME = "Background Service";
|
||||
public static NotificationCompat.Builder createAlertNotificationBuilder(Context context, String contentTitle, String contentText,
|
||||
String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
|
||||
boolean autocancel, boolean ongoing, boolean onlyAlertOnce) {
|
||||
|
@ -147,10 +149,9 @@ public class AlertNotificationFactory {
|
|||
return notifBuilder.build();
|
||||
}
|
||||
|
||||
@RequiresApi(android.os.Build.VERSION_CODES.O)
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
public static void createNotificationChanel(Context context) {
|
||||
String channelName = "Background Service";
|
||||
NotificationChannel channel = new NotificationChannel(SWADROID_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_DEFAULT);
|
||||
NotificationChannel channel = new NotificationChannel(SWADROID_CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
assert manager != null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user