Search in sources :

Example 1 with NotificationChannel

use of android.app.NotificationChannel in project mobile-center-sdk-android by Microsoft.

the class Distribute method notifyDownload.

/**
 * Post notification about a completed download if we are in background when download completes.
 * If this method is called on app process restart or if application is in foreground
 * when download completes, it will not notify and return that the install U.I. should be shown now.
 *
 * @param releaseDetails release details to check state.
 * @param intent         prepared install intent.
 * @return false if install U.I should be shown now, true if a notification was posted or if the task was canceled.
 */
synchronized boolean notifyDownload(ReleaseDetails releaseDetails, Intent intent) {
    /* Check state. */
    if (releaseDetails != mReleaseDetails) {
        return true;
    }
    /*
         * If we already notified, that means this check was triggered by application being resumed,
         * thus in foreground at the moment the check download async task was started.
         *
         * We should not hold the install any longer now, even if the async task was long enough
         * for app to be in background again, we should show install U.I. now.
         */
    if (mForegroundActivity != null || getStoredDownloadState() == DOWNLOAD_STATE_NOTIFIED) {
        return false;
    }
    /* Post notification. */
    AppCenterLog.debug(LOG_TAG, "Post a notification as the download finished in background.");
    NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    Notification.Builder builder;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        /* Create or update notification channel (mandatory on Android 8 target). */
        NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, mContext.getString(R.string.appcenter_distribute_notification_category), NotificationManager.IMPORTANCE_DEFAULT);
        notificationManager.createNotificationChannel(channel);
        builder = new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID);
    } else {
        builder = getOldNotificationBuilder();
    }
    builder.setTicker(mContext.getString(R.string.appcenter_distribute_install_ready_title)).setContentTitle(mContext.getString(R.string.appcenter_distribute_install_ready_title)).setContentText(getInstallReadyMessage()).setSmallIcon(mContext.getApplicationInfo().icon).setContentIntent(PendingIntent.getActivities(mContext, 0, new Intent[] { intent }, 0));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        builder.setStyle(new Notification.BigTextStyle().bigText(getInstallReadyMessage()));
    }
    Notification notification = DistributeUtils.buildNotification(builder);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(DistributeUtils.getNotificationId(), notification);
    PreferencesStorage.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_NOTIFIED);
    /* Reset check download flag to show install U.I. on resume if notification ignored. */
    mCheckedDownload = false;
    return true;
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationManager(android.app.NotificationManager) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) Notification(android.app.Notification)

Example 2 with NotificationChannel

use of android.app.NotificationChannel in project Android-SDK by Backendless.

the class PushTemplateHelper method convertFromTemplate.

static Notification convertFromTemplate(Context context, AndroidPushTemplate template, String messageText, int messageId) {
    context = context.getApplicationContext();
    // Notification channel ID is ignored for Android 7.1.1 (API level 25) and lower.
    NotificationCompat.Builder notificationBuilder;
    // android.os.Build.VERSION_CODES.O == 26
    if (android.os.Build.VERSION.SDK_INT > 25) {
        NotificationChannel notificationChannel = getOrCreateNotificationChannel(context, template);
        notificationBuilder = new NotificationCompat.Builder(context, notificationChannel.getId());
        if (template.getColorized() != null)
            notificationBuilder.setColorized(template.getColorized());
        if (template.getBadge() != null && (template.getBadge() == NotificationCompat.BADGE_ICON_SMALL || template.getBadge() == NotificationCompat.BADGE_ICON_LARGE))
            notificationBuilder.setBadgeIconType(template.getBadge());
        else
            notificationBuilder.setBadgeIconType(NotificationCompat.BADGE_ICON_NONE);
        if (template.getCancelAfter() != null && template.getCancelAfter() != 0)
            notificationBuilder.setTimeoutAfter(template.getCancelAfter() * 1000);
    } else {
        notificationBuilder = new NotificationCompat.Builder(context);
        if (template.getPriority() != null && template.getPriority() > 0 && template.getPriority() < 6)
            notificationBuilder.setPriority(template.getPriority() - 3);
        else
            notificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT);
        if (notificationBuilder.getPriority() > NotificationCompat.PRIORITY_LOW) {
            Uri soundUri;
            if (template.getButtonTemplate() != null && template.getButtonTemplate().getSound() != null && !template.getButtonTemplate().getSound().isEmpty()) {
                int soundResource = context.getResources().getIdentifier(template.getButtonTemplate().getSound(), "raw", context.getPackageName());
                soundUri = Uri.parse("android.resource://" + context.getPackageName() + "/" + soundResource);
            } else
                soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            notificationBuilder.setSound(soundUri, AudioManager.STREAM_NOTIFICATION);
        }
        if (template.getButtonTemplate().getVibrate() != null && template.getButtonTemplate().getVibrate().length > 0 && notificationBuilder.getPriority() > NotificationCompat.PRIORITY_LOW) {
            long[] vibrate = new long[template.getButtonTemplate().getVibrate().length];
            int index = 0;
            for (long l : template.getButtonTemplate().getVibrate()) vibrate[index++] = l;
            notificationBuilder.setVibrate(vibrate);
        }
        if (template.getButtonTemplate().getVisibility() != null)
            notificationBuilder.setVisibility(template.getButtonTemplate().getVisibility());
        else
            notificationBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
    }
    if (template.getAttachmentUrl() != null) {
        try {
            InputStream is = (InputStream) new URL(template.getAttachmentUrl()).getContent();
            Bitmap bitmap = BitmapFactory.decodeStream(is);
            if (bitmap != null)
                notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(bitmap));
            else
                Log.i(PushTemplateHelper.class.getSimpleName(), "Cannot convert rich media for notification into bitmap.");
        } catch (IOException e) {
            Log.e(PushTemplateHelper.class.getSimpleName(), "Cannot receive rich media for notification.");
        }
    } else if (messageText.length() > 35) {
        NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle().setSummaryText(template.getThirdRowTitle()).setBigContentTitle(template.getFirstRowTitle()).bigText(messageText);
        notificationBuilder.setStyle(bigText);
    }
    if (template.getLargeIcon() != null) {
        if (template.getLargeIcon().startsWith("http")) {
            try {
                InputStream is = (InputStream) new URL(template.getLargeIcon()).getContent();
                Bitmap bitmap = BitmapFactory.decodeStream(is);
                if (bitmap != null)
                    notificationBuilder.setLargeIcon(bitmap);
                else
                    Log.i(PushTemplateHelper.class.getSimpleName(), "Cannot convert Large Icon into bitmap.");
            } catch (IOException e) {
                Log.e(PushTemplateHelper.class.getSimpleName(), "Cannot receive bitmap for Large Icon.");
            }
        } else {
            int largeIconResource = context.getResources().getIdentifier(template.getLargeIcon(), "raw", context.getPackageName());
            if (largeIconResource != 0) {
                Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), largeIconResource);
                notificationBuilder.setLargeIcon(bitmap);
            }
        }
    }
    int icon = 0;
    if (template.getIcon() != null)
        icon = context.getResources().getIdentifier(template.getIcon(), "drawable", context.getPackageName());
    if (icon == 0)
        icon = context.getResources().getIdentifier("ic_launcher", "drawable", context.getPackageName());
    if (icon != 0)
        notificationBuilder.setSmallIcon(icon);
    if (template.getLightsColor() != null && template.getLightsOnMs() != null && template.getLightsOffMs() != null)
        notificationBuilder.setLights(template.getLightsColor() | 0xFF000000, template.getLightsOnMs(), template.getLightsOffMs());
    if (template.getColorCode() != null)
        notificationBuilder.setColor(template.getColorCode() | 0xFF000000);
    if (template.getCancelOnTap() != null)
        notificationBuilder.setAutoCancel(template.getCancelOnTap());
    else
        notificationBuilder.setAutoCancel(false);
    notificationBuilder.setShowWhen(true).setWhen(System.currentTimeMillis()).setContentTitle(template.getFirstRowTitle()).setSubText(template.getThirdRowTitle()).setTicker(template.getTickerText()).setContentText(messageText);
    Intent notificationIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    notificationIntent.putExtra(BackendlessBroadcastReceiver.EXTRA_MESSAGE_ID, messageId);
    notificationIntent.putExtra(PublishOptions.TEMPLATE_NAME, template.getName());
    notificationIntent.putExtra(PublishOptions.MESSAGE_TAG, messageText);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(context, messageId * 3, notificationIntent, 0);
    notificationBuilder.setContentIntent(contentIntent);
    if (template.getButtonTemplate().getActions() != null) {
        List<NotificationCompat.Action> actions = createActions(context, template.getButtonTemplate().getActions(), template.getName(), messageId, messageText);
        for (NotificationCompat.Action action : actions) notificationBuilder.addAction(action);
    }
    return notificationBuilder.build();
}
Also used : Action(com.backendless.messaging.Action) InputStream(java.io.InputStream) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) IOException(java.io.IOException) Uri(android.net.Uri) URL(java.net.URL) NotificationChannel(android.app.NotificationChannel) Bitmap(android.graphics.Bitmap) NotificationCompat(android.support.v4.app.NotificationCompat) PendingIntent(android.app.PendingIntent)

Example 3 with NotificationChannel

use of android.app.NotificationChannel in project xabber-android by redsolution.

the class NotificationManager method createNotificationChannelService.

@RequiresApi(api = Build.VERSION_CODES.O)
private String createNotificationChannelService() {
    String channelId = "xabber_service";
    String channelName = "Xabber Background Service";
    @SuppressLint("WrongConstant") NotificationChannel channel = new NotificationChannel(channelId, channelName, android.app.NotificationManager.IMPORTANCE_NONE);
    android.app.NotificationManager service = (android.app.NotificationManager) Application.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
    if (service != null)
        service.createNotificationChannel(channel);
    return channelId;
}
Also used : NotificationChannel(android.app.NotificationChannel) SuppressLint(android.annotation.SuppressLint) RequiresApi(android.support.annotation.RequiresApi)

Example 4 with NotificationChannel

use of android.app.NotificationChannel in project twicalico by moko256.

the class GlobalApplication method onCreate.

@Override
public void onCreate() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        NotificationChannel channel = new NotificationChannel("crash_log", getString(R.string.crash_log), NotificationManager.IMPORTANCE_DEFAULT);
        channel.setDescription(getString(R.string.crash_log_channel_description));
        channel.setLightColor(Color.RED);
        channel.enableLights(true);
        channel.setShowBadge(false);
        channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        if (manager != null) {
            manager.createNotificationChannel(channel);
        }
    }
    final Thread.UncaughtExceptionHandler defaultUnCaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
        try {
            new ExceptionNotification().create(e, getApplicationContext());
        } catch (Throwable fe) {
            fe.printStackTrace();
        } finally {
            defaultUnCaughtExceptionHandler.uncaughtException(t, e);
        }
    });
    SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    configuration = new AppConfiguration();
    configuration.isPatternTweetMuteEnabled = defaultSharedPreferences.getBoolean("patternTweetMuteEnabled", false);
    if (configuration.isPatternTweetMuteEnabled) {
        try {
            configuration.tweetMutePattern = Pattern.compile(defaultSharedPreferences.getString("tweetMutePattern", ""));
        } catch (PatternSyntaxException e) {
            e.printStackTrace();
            configuration.isPatternTweetMuteEnabled = false;
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    configuration.isPatternTweetMuteShowOnlyImageEnabled = defaultSharedPreferences.getBoolean("patternTweetMuteShowOnlyImageEnabled", false);
    if (configuration.isPatternTweetMuteShowOnlyImageEnabled) {
        try {
            configuration.tweetMuteShowOnlyImagePattern = Pattern.compile(defaultSharedPreferences.getString("tweetMuteShowOnlyImagePattern", ""));
        } catch (PatternSyntaxException e) {
            e.printStackTrace();
            configuration.isPatternTweetMuteShowOnlyImageEnabled = false;
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    configuration.isPatternUserScreenNameMuteEnabled = defaultSharedPreferences.getBoolean("patternUserScreenNameMuteEnabled", false);
    if (configuration.isPatternUserScreenNameMuteEnabled) {
        try {
            configuration.userScreenNameMutePattern = Pattern.compile(defaultSharedPreferences.getString("userScreenNameMutePattern", ""));
        } catch (PatternSyntaxException e) {
            e.printStackTrace();
            configuration.isPatternUserScreenNameMuteEnabled = false;
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    configuration.isPatternUserNameMuteEnabled = defaultSharedPreferences.getBoolean("patternUserNameMuteEnabled", false);
    if (configuration.isPatternUserNameMuteEnabled) {
        try {
            configuration.userNameMutePattern = Pattern.compile(defaultSharedPreferences.getString("userNameMutePattern", ""));
        } catch (PatternSyntaxException e) {
            e.printStackTrace();
            configuration.isPatternUserNameMuteEnabled = false;
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    configuration.isPatternTweetSourceMuteEnabled = defaultSharedPreferences.getBoolean("patternTweetSourceMuteEnabled", false);
    if (configuration.isPatternTweetSourceMuteEnabled) {
        try {
            configuration.tweetSourceMutePattern = Pattern.compile(defaultSharedPreferences.getString("tweetSourceMutePattern", ""));
        } catch (PatternSyntaxException e) {
            e.printStackTrace();
            configuration.isPatternTweetSourceMuteEnabled = false;
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }
    configuration.isTimelineImageLoad = Boolean.valueOf(defaultSharedPreferences.getString("isTimelineImageLoad", "true"));
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    @AppCompatDelegate.NightMode int mode = AppCompatDelegate.MODE_NIGHT_NO;
    switch(defaultSharedPreferences.getString("nightModeType", "mode_night_no_value")) {
        case "mode_night_no":
            mode = AppCompatDelegate.MODE_NIGHT_NO;
            break;
        case "mode_night_auto":
            mode = AppCompatDelegate.MODE_NIGHT_AUTO;
            break;
        case "mode_night_follow_system":
            mode = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
            break;
        case "mode_night_yes":
            mode = AppCompatDelegate.MODE_NIGHT_YES;
            break;
    }
    AppCompatDelegate.setDefaultNightMode(mode);
    String accountKey = defaultSharedPreferences.getString("AccountKey", "-1");
    if (accountKey.equals("-1"))
        return;
    TokenSQLiteOpenHelper tokenOpenHelper = new TokenSQLiteOpenHelper(this);
    AccessToken accessToken = tokenOpenHelper.getAccessToken(accountKey);
    tokenOpenHelper.close();
    if (accessToken == null)
        return;
    initTwitter(accessToken);
    super.onCreate();
}
Also used : NotificationManager(android.app.NotificationManager) SharedPreferences(android.content.SharedPreferences) NotificationChannel(android.app.NotificationChannel) AccessToken(com.github.moko256.twicalico.entity.AccessToken) ExceptionNotification(com.github.moko256.twicalico.notification.ExceptionNotification) AppConfiguration(com.github.moko256.twicalico.config.AppConfiguration) TokenSQLiteOpenHelper(com.github.moko256.twicalico.database.TokenSQLiteOpenHelper) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 5 with NotificationChannel

use of android.app.NotificationChannel in project android_packages_apps_Settings by LineageOS.

the class BluetoothPermissionRequest method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    mContext = context;
    String action = intent.getAction();
    if (DEBUG)
        Log.d(TAG, "onReceive" + action);
    if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST)) {
        UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
        // skip the notification for managed profiles.
        if (um.isManagedProfile()) {
            if (DEBUG)
                Log.d(TAG, "Blocking notification for managed profile.");
            return;
        }
        // convert broadcast intent into activity intent (same action string)
        mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        mRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION);
        mReturnPackage = intent.getStringExtra(BluetoothDevice.EXTRA_PACKAGE_NAME);
        mReturnClass = intent.getStringExtra(BluetoothDevice.EXTRA_CLASS_NAME);
        if (DEBUG)
            Log.d(TAG, "onReceive request type: " + mRequestType + " return " + mReturnPackage + "," + mReturnClass);
        // dialog or notification.
        if (checkUserChoice()) {
            return;
        }
        Intent connectionAccessIntent = new Intent(action);
        connectionAccessIntent.setClass(context, BluetoothPermissionActivity.class);
        // We use the FLAG_ACTIVITY_MULTIPLE_TASK since we can have multiple concurrent access
        // requests.
        connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        // This is needed to create two pending intents to the same activity. The value is not
        // used in the activity.
        connectionAccessIntent.setType(Integer.toString(mRequestType));
        connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
        connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
        connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_PACKAGE_NAME, mReturnPackage);
        connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, mReturnClass);
        String deviceAddress = mDevice != null ? mDevice.getAddress() : null;
        String deviceName = mDevice != null ? mDevice.getName() : null;
        String title = null;
        String message = null;
        PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        if (powerManager.isScreenOn() && LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress, deviceName)) {
            context.startActivity(connectionAccessIntent);
        } else {
            // Put up a notification that leads to the dialog
            // Create an intent triggered by clicking on the
            // "Clear All Notifications" button
            Intent deleteIntent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY);
            deleteIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
            deleteIntent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, BluetoothDevice.CONNECTION_ACCESS_NO);
            deleteIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
            String deviceAlias = Utils.createRemoteName(context, mDevice);
            switch(mRequestType) {
                case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
                    title = context.getString(R.string.bluetooth_phonebook_request);
                    message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text, deviceAlias, deviceAlias);
                    break;
                case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
                    title = context.getString(R.string.bluetooth_map_request);
                    message = context.getString(R.string.bluetooth_map_acceptance_dialog_text, deviceAlias, deviceAlias);
                    break;
                case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS:
                    title = context.getString(R.string.bluetooth_sap_request);
                    message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text, deviceAlias, deviceAlias);
                    break;
                default:
                    title = context.getString(R.string.bluetooth_connection_permission_request);
                    message = context.getString(R.string.bluetooth_connection_dialog_text, deviceAlias, deviceAlias);
                    break;
            }
            NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            if (mNotificationChannel == null) {
                mNotificationChannel = new NotificationChannel(BLUETOOTH_NOTIFICATION_CHANNEL, context.getString(R.string.bluetooth), NotificationManager.IMPORTANCE_HIGH);
                notificationManager.createNotificationChannel(mNotificationChannel);
            }
            Notification notification = new Notification.Builder(context, BLUETOOTH_NOTIFICATION_CHANNEL).setContentTitle(title).setTicker(message).setContentText(message).setSmallIcon(android.R.drawable.stat_sys_data_bluetooth).setAutoCancel(true).setPriority(Notification.PRIORITY_MAX).setOnlyAlertOnce(false).setDefaults(Notification.DEFAULT_ALL).setContentIntent(PendingIntent.getActivity(context, 0, connectionAccessIntent, 0)).setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0)).setColor(context.getColor(com.android.internal.R.color.system_notification_accent_color)).setLocalOnly(true).build();
            // Cannot be set with the builder.
            notification.flags |= Notification.FLAG_NO_CLEAR;
            notificationManager.notify(getNotificationTag(mRequestType), NOTIFICATION_ID, notification);
        }
    } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
        // Remove the notification
        NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
        manager.cancel(getNotificationTag(mRequestType), NOTIFICATION_ID);
    }
}
Also used : PowerManager(android.os.PowerManager) NotificationChannel(android.app.NotificationChannel) NotificationManager(android.app.NotificationManager) UserManager(android.os.UserManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Aggregations

NotificationChannel (android.app.NotificationChannel)465 NotificationManager (android.app.NotificationManager)182 Test (org.junit.Test)180 Intent (android.content.Intent)72 PendingIntent (android.app.PendingIntent)66 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)59 NotificationCompat (android.support.v4.app.NotificationCompat)45 Notification (android.app.Notification)34 Preference (androidx.preference.Preference)33 RequiresApi (android.support.annotation.RequiresApi)29 NotificationChannelGroup (android.app.NotificationChannelGroup)28 TargetApi (android.annotation.TargetApi)25 AudioAttributes (android.media.AudioAttributes)22 Uri (android.net.Uri)19 SuppressLint (android.annotation.SuppressLint)18 RequiresApi (androidx.annotation.RequiresApi)15 ArrayList (java.util.ArrayList)13 RestrictedListPreference (com.android.settings.RestrictedListPreference)10 Context (android.content.Context)9 SharedPreferences (android.content.SharedPreferences)9