use of androidx.core.app.TaskStackBuilder in project android_packages_apps_Settings by omnirom.
the class SimActivationNotifier method sendSwitchedToRemovableSlotNotification.
/**
* Sends a push notification for switching to the removable slot.
*/
public void sendSwitchedToRemovableSlotNotification() {
String carrierName = getActiveCarrierName();
Intent clickIntent = new Intent(mContext, Settings.MobileNetworkListActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext).addNextIntent(clickIntent);
PendingIntent contentIntent = stackBuilder.getPendingIntent(0, /* requestCode */
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
String titleText = TextUtils.isEmpty(carrierName) ? mContext.getString(R.string.switch_to_removable_notification_no_carrier_name) : mContext.getString(R.string.switch_to_removable_notification, carrierName);
Notification.Builder builder = new Notification.Builder(mContext, SWITCH_SLOT_CHANNEL_ID).setContentTitle(titleText).setContentText(mContext.getString(R.string.network_changed_notification_text)).setContentIntent(contentIntent).setSmallIcon(R.drawable.ic_sim_alert).setColor(mContext.getResources().getColor(R.color.homepage_generic_icon_background, null)).setAutoCancel(true);
mNotificationManager.notify(SWITCH_TO_REMOVABLE_SLOT_NOTIFICATION_ID, builder.build());
}
Aggregations