use of android.app.NotificationManager in project android_frameworks_base by ResurrectionRemix.
the class BaseStatusBar method showNavigationNotification.
private void showNavigationNotification(boolean show) {
NotificationManager noMan = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (show && !mIsNavNotificationShowing) {
Intent intent = new Intent(ACTION_ENABLE_NAVIGATION_KEY);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.setPackage(mContext.getPackageName());
final PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
final Notification notification = new Notification.Builder(mContext).setContentTitle(mContext.getResources().getString(R.string.no_navigation_warning_title)).setContentText(mContext.getResources().getString(R.string.no_navigation_warning_text)).setSmallIcon(R.drawable.no_navigation_warning_icon).setOngoing(true).setAutoCancel(false).setVisibility(Notification.VISIBILITY_PUBLIC).setContentIntent(pendingIntent).build();
mIsNavNotificationShowing = true;
noMan.notify(R.string.no_navigation_warning_title, notification);
} else if (mIsNavNotificationShowing) {
mIsNavNotificationShowing = false;
noMan.cancel(R.string.no_navigation_warning_title);
}
}
use of android.app.NotificationManager in project android_frameworks_base by ResurrectionRemix.
the class Tethering method clearTetheredNotification.
private void clearTetheredNotification() {
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null && mLastNotificationId != 0) {
notificationManager.cancelAsUser(null, mLastNotificationId, UserHandle.ALL);
mLastNotificationId = 0;
}
}
use of android.app.NotificationManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSelectNotification method createNotification.
private void createNotification(Context context) {
final Resources resources = context.getResources();
NotificationCompat.Builder builder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_sim_card_alert_white_48dp).setColor(context.getColor(R.color.sim_noitification)).setContentTitle(resources.getString(R.string.sim_notification_title)).setContentText(resources.getString(R.string.sim_notification_summary));
Intent resultIntent = new Intent(context, SimSettingsActivity.class);
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_CANCEL_CURRENT);
builder.setContentIntent(resultPendingIntent);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, builder.build());
}
use of android.app.NotificationManager in project RSAndroidApp by RailwayStations.
the class MyFirebaseMessagingService method onMessageReceived.
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// Handle data payload of FCM messages.
Log.d(TAG, "onMessageReceived");
Log.d(TAG, "FCM Message Id: " + remoteMessage.getMessageId());
Log.d(TAG, "FCM Notification Message: " + remoteMessage.getNotification());
Log.d(TAG, "FCM Data Message: " + remoteMessage.getData());
String title = remoteMessage.getNotification().getTitle();
String message = remoteMessage.getNotification().getBody();
String click_action = remoteMessage.getNotification().getClickAction();
Intent intent = new Intent(click_action);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
notificationBuilder.setContentTitle(title);
notificationBuilder.setContentText(message);
notificationBuilder.setSmallIcon(R.mipmap.ic_launcher);
notificationBuilder.setAutoCancel(true);
notificationBuilder.setGroup(KEY_NOTIFICATION_GROUP);
notificationBuilder.setGroupSummary(true);
notificationBuilder.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}
use of android.app.NotificationManager in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mgr.cancel(PackageReceiver.NOTIFY_ID);
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
getFragmentManager().beginTransaction().add(android.R.id.content, new SettingsFragment()).commit();
}
}
Aggregations