use of android.app.NotificationManager in project fresco by facebook.
the class ImagePipelineNotificationFragment method displayNotification.
private void displayNotification(@Nullable Bitmap bitmap) {
final NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext()).setSmallIcon(R.drawable.ic_done).setLargeIcon(bitmap).setContentTitle(getString(R.string.imagepipeline_notification_content_title)).setContentText(getString(R.string.imagepipeline_notification_content_text));
final NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
}
use of android.app.NotificationManager in project quickstart-android by firebase.
the class MyFirebaseMessagingService method sendNotification.
// [END receive_message]
/**
* Create and show a simple notification containing the received FCM message.
*
* @param messageBody FCM message body received.
*/
private void sendNotification(String messageBody) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, /* Request code */
intent, PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_stat_ic_notification).setContentTitle("FCM Message").setContentText(messageBody).setAutoCancel(true).setSound(defaultSoundUri).setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, /* ID of notification */
notificationBuilder.build());
}
use of android.app.NotificationManager in project quickstart-android by firebase.
the class MyBaseTaskService method dismissProgressNotification.
/**
* Dismiss the progress notification.
*/
protected void dismissProgressNotification() {
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancel(PROGRESS_NOTIFICATION_ID);
}
use of android.app.NotificationManager in project quickstart-android by firebase.
the class MyBaseTaskService method showProgressNotification.
/**
* Show notification with a progress bar.
*/
protected void showProgressNotification(String caption, long completedUnits, long totalUnits) {
int percentComplete = 0;
if (totalUnits > 0) {
percentComplete = (int) (100 * completedUnits / totalUnits);
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_file_upload_white_24dp).setContentTitle(getString(R.string.app_name)).setContentText(caption).setProgress(100, percentComplete, false).setOngoing(true).setAutoCancel(false);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(PROGRESS_NOTIFICATION_ID, builder.build());
}
use of android.app.NotificationManager in project FBReaderJ by geometer.
the class NotificationUtil method drop.
public static void drop(Context context, int id) {
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(id);
}
Aggregations