Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/Notifications.java
package it.reyboz.bustorino.backend; | package it.reyboz.bustorino.backend; | ||||
import android.app.NotificationChannel; | import android.app.NotificationChannel; | ||||
import android.app.NotificationManager; | import android.app.NotificationManager; | ||||
import android.content.Context; | import android.content.Context; | ||||
import android.os.Build; | import android.os.Build; | ||||
import it.reyboz.bustorino.R; | import it.reyboz.bustorino.R; | ||||
public class Notifications { | public class Notifications { | ||||
public static final String DEFAULT_CHANNEL_ID ="Default"; | public static final String DEFAULT_CHANNEL_ID ="Default"; | ||||
public static final String DB_UPDATE_CHANNELS_ID ="Database Update"; | |||||
public static void createDefaultNotificationChannel(Context context) { | public static void createDefaultNotificationChannel(Context context) { | ||||
// Create the NotificationChannel, but only on API 26+ because | // Create the NotificationChannel, but only on API 26+ because | ||||
// the NotificationChannel class is new and not in the support library | // the NotificationChannel class is new and not in the support library | ||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||||
CharSequence name = context.getString(R.string.default_notification_channel); | CharSequence name = context.getString(R.string.default_notification_channel); | ||||
String description = context.getString(R.string.default_notification_channel_description); | String description = context.getString(R.string.default_notification_channel_description); | ||||
int importance = NotificationManager.IMPORTANCE_DEFAULT; | int importance = NotificationManager.IMPORTANCE_DEFAULT; | ||||
Show All 28 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register