Tabnine Logo
NotificationManagerCompat.from
Code IndexAdd Tabnine to your IDE (free)

How to use
from
method
in
androidx.core.app.NotificationManagerCompat

Best Java code snippets using androidx.core.app.NotificationManagerCompat.from (Showing top 20 results out of 315)

origin: ankidroid/Anki-Android

final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
origin: jruesga/rview

public static void dismissNotification(Context ctx, int groupId) {
  NotificationManagerCompat notificationManager = NotificationManagerCompat.from(ctx);
  notificationManager.cancel(groupId);
}
origin: jruesga/rview

private static void publishNotification(Context ctx, Notification notification, int groupId) {
  NotificationManagerCompat notificationManager = NotificationManagerCompat.from(ctx);
  notificationManager.notify(groupId, notification);
}
origin: saki4510t/libcommon

/**
 * 通知発行用のヘルパークラス
 * @param context
 * @param tag
 * @param notificationId
 * @param notification
 */
private static void notify(@NonNull final Context context,
  @Nullable final String tag, final int notificationId,
  @NonNull final Notification notification) {
  
  NotificationManagerCompat.from(context)
    .notify(tag, notificationId, notification);
}

origin: googlesamples/android-Notifications

/**
 * Handles action Dismiss in the provided background thread.
 */
private void handleActionDismiss() {
  Log.d(TAG, "handleActionDismiss()");
  NotificationManagerCompat notificationManagerCompat =
      NotificationManagerCompat.from(getApplicationContext());
  notificationManagerCompat.cancel(StandaloneMainActivity.NOTIFICATION_ID);
}
origin: googlesamples/android-Notifications

/**
 * Handles action Dismiss in the provided background thread.
 */
private void handleActionDismiss() {
  Log.d(TAG, "handleActionDismiss()");
  NotificationManagerCompat notificationManagerCompat =
      NotificationManagerCompat.from(getApplicationContext());
  notificationManagerCompat.cancel(MainActivity.NOTIFICATION_ID);
}
origin: MCMrARM/revolution-irc

public void cancelNotification(Context context) {
  boolean updateSummary = false;
  synchronized (this) {
    mMessages.clear();
  }
  synchronized (mShowingNotificationLock) {
    // cancel the notification
    if (mShowingNotification) {
      NotificationManagerCompat.from(context).cancel(mNotificationId);
      mShowingNotification = false;
      updateSummary = true;
    }
  }
  if (updateSummary)
    NotificationManager.getInstance().updateSummaryNotification(context, null);
}
origin: googlesamples/android-Notifications

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mMainRelativeLayout = (RelativeLayout) findViewById(R.id.mainRelativeLayout);
  mNotificationDetailsTextView = (TextView) findViewById(R.id.notificationDetails);
  mSpinner = (Spinner) findViewById(R.id.spinner);
  mNotificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
  // Create an ArrayAdapter using the string array and a default spinner layout.
  ArrayAdapter<CharSequence> adapter =
      new ArrayAdapter(
          this,
          android.R.layout.simple_spinner_item,
          NOTIFICATION_STYLES);
  // Specify the layout to use when the list of choices appears.
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  // Apply the adapter to the spinner.
  mSpinner.setAdapter(adapter);
  mSpinner.setOnItemSelectedListener(this);
}
origin: MCMrARM/revolution-irc

public void setOpened(Context context, boolean opened) {
  boolean updateSummary = false;
  synchronized (this) {
    mOpened = opened;
    if (mOpened) {
      mMessages.clear();
      synchronized (mShowingNotificationLock) {
        // cancel the notification
        if (mShowingNotification) {
          NotificationManagerCompat.from(context).cancel(mNotificationId);
          mShowingNotification = false;
          updateSummary = true;
        }
      }
    }
  }
  if (updateSummary)
    NotificationManager.getInstance().updateSummaryNotification(context, null);
}
origin: googlesamples/android-Notifications

/**
 * Handles action Snooze in the provided background thread.
 */
private void handleActionSnooze() {
  Log.d(TAG, "handleActionSnooze()");
  // You could use NotificationManager.getActiveNotifications() if you are targeting SDK 23
  // and above, but we are targeting devices with lower SDK API numbers, so we saved the
  // builder globally and get the notification back to recreate it later.
  NotificationCompat.Builder notificationCompatBuilder =
      GlobalNotificationBuilder.getNotificationCompatBuilderInstance();
  // Recreate builder from persistent state if app process is killed
  if (notificationCompatBuilder == null) {
    // Note: New builder set globally in the method
    notificationCompatBuilder = recreateBuilderWithBigTextStyle();
  }
  Notification notification;
  notification = notificationCompatBuilder.build();
  if (notification != null) {
    NotificationManagerCompat notificationManagerCompat =
        NotificationManagerCompat.from(getApplicationContext());
    notificationManagerCompat.cancel(MainActivity.NOTIFICATION_ID);
    try {
      Thread.sleep(SNOOZE_TIME);
    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
    notificationManagerCompat.notify(MainActivity.NOTIFICATION_ID, notification);
  }
}
origin: googlesamples/android-Notifications

/**
 * Handles action Snooze in the provided background thread.
 */
private void handleActionSnooze() {
  Log.d(TAG, "handleActionSnooze()");
  // You could use NotificationManager.getActiveNotifications() if you are targeting SDK 23
  // and above, but we are targeting devices with lower SDK API numbers, so we saved the
  // builder globally and get the notification back to recreate it later.
  NotificationCompat.Builder notificationCompatBuilder =
      GlobalNotificationBuilder.getNotificationCompatBuilderInstance();
  // Recreate builder from persistent state if app process is killed
  if (notificationCompatBuilder == null) {
    // Note: New builder set globally in the method
    notificationCompatBuilder = recreateBuilderWithBigTextStyle();
  }
  Notification notification;
  notification = notificationCompatBuilder.build();
  if (notification != null) {
    NotificationManagerCompat notificationManagerCompat =
        NotificationManagerCompat.from(getApplicationContext());
    notificationManagerCompat.cancel(StandaloneMainActivity.NOTIFICATION_ID);
    try {
      Thread.sleep(SNOOZE_TIME);
    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }
    notificationManagerCompat.notify(StandaloneMainActivity.NOTIFICATION_ID, notification);
  }
}
origin: MCMrARM/revolution-irc

@Override
public void onMessageSent() {
  NotificationManagerCompat notificationManager =
      NotificationManagerCompat.from(mContext);
  notificationManager.cancel(mNotificationId);
  NotificationManager.getInstance().onNotificationDismissed(mContext, mConnection,
      mChannel);
  NotificationManager.getInstance().updateSummaryNotification(mContext, null);
}
origin: googlesamples/android-Notifications

    NotificationManagerCompat.from(getApplicationContext());
notificationManagerCompat.notify(MainActivity.NOTIFICATION_ID, updatedNotification);
origin: googlesamples/android-Notifications

    NotificationManagerCompat.from(getApplicationContext());
notificationManagerCompat.notify(
    StandaloneMainActivity.NOTIFICATION_ID,
origin: Sparker0i/Weather

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_weather);
mManager = NotificationManagerCompat.from(this);
preferences = new Prefs(this);
toolbar = findViewById(R.id.toolbar);
origin: googlesamples/android-Notifications

    NotificationManagerCompat.from(getApplicationContext());
notificationManagerCompat.notify(MainActivity.NOTIFICATION_ID, notification);
origin: googlesamples/android-Notifications

    NotificationManagerCompat.from(getApplicationContext());
notificationManagerCompat.notify(StandaloneMainActivity.NOTIFICATION_ID, notification);
origin: MCMrARM/revolution-irc

  NotificationManagerCompat.from(context).cancel(CHAT_SUMMARY_NOTIFICATION_ID);
  return;
      .setContentIntent(intent);
NotificationManagerCompat.from(context).notify(CHAT_SUMMARY_NOTIFICATION_ID, notification.build());
origin: googlesamples/android-Notifications

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Log.d(TAG, "onCreate()");
  setContentView(R.layout.activity_main);
  // Enables Ambient mode.
  mAmbientController = AmbientMode.attachAmbientSupport(this);
  mNotificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
  mMainFrameLayout = findViewById(R.id.mainFrameLayout);
  mWearableRecyclerView = findViewById(R.id.recycler_view);
  // Aligns the first and last items on the list vertically centered on the screen.
  mWearableRecyclerView.setEdgeItemsCenteringEnabled(true);
  // Customizes scrolling so items farther away form center are smaller.
  ScalingScrollLayoutCallback scalingScrollLayoutCallback =
      new ScalingScrollLayoutCallback();
  mWearableRecyclerView.setLayoutManager(
      new WearableLinearLayoutManager(this, scalingScrollLayoutCallback));
  // Improves performance because we know changes in content do not change the layout size of
  // the RecyclerView.
  mWearableRecyclerView.setHasFixedSize(true);
  // Specifies an adapter (see also next example).
  mCustomRecyclerAdapter = new CustomRecyclerAdapter(
      NOTIFICATION_STYLES,
      // Controller passes selected data from the Adapter out to this Activity to trigger
      // updates in the UI/Notifications.
      new Controller(this));
  mWearableRecyclerView.setAdapter(mCustomRecyclerAdapter);
}
origin: cbeyls/fosdem-companion-android

Event event = AppDatabase.getInstance(this).getScheduleDao().getEvent(eventId);
if (event != null) {
  NotificationManagerCompat.from(this).notify((int) eventId, buildNotification(event));
androidx.core.appNotificationManagerCompatfrom

Popular methods of NotificationManagerCompat

  • notify
  • cancel
  • areNotificationsEnabled

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Join (org.hibernate.mapping)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now