下面列出了怎么用android.support.v4.app.NotificationCompat的API类实例代码及写法,或者点击链接到github查看源代码。
public void failureNotification() {
NotificationCompat.Builder builder = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder = new NotificationCompat.Builder(context, DOWNLOAD_NOTIFICATION_CHANNEL_ID);
} else {
builder = new NotificationCompat.Builder(context);
}
builder.setContentTitle(titleText)
.setContentText(failureText)
.setContentInfo("")
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setOngoing(false)
.setSmallIcon(android.R.drawable.stat_sys_download);
notificationManager.notify(id, builder.build());
}
private Notification getNotification(final String tickerText,
final String titleText, final String contentText,
int number, int smallIcon, Bitmap image, Photo photo) {
return new NotificationCompat.BigPictureStyle(
new NotificationCompat.Builder(mContext)
.setContentTitle(titleText)
.setContentText(contentText)
.setNumber(number)
.setTicker(tickerText)
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL)
.setContentIntent(getPendingIntent(photo))
.setLargeIcon(BitmapFactory.decodeResource(
mContext.getResources(), R.drawable.ic_notification))
.setSmallIcon(smallIcon))
.bigPicture(image)
.setSummaryText(contentText)
.setBigContentTitle(titleText)
.build();
}
/**
* Builds and posts a notification from a set of options.
* @param options The options to build the notification.
*/
public void postActionNotification(NotificationOptions options) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(options.getSmallIconResourceId());
builder.setContentTitle(options.getTitle());
builder.setContentText(options.getContent());
builder.setDefaults(options.getNotificationDefaults());
builder.setPriority(options.getNotificationPriority());
builder.setVibrate(options.getVibratePattern());
if (options.getActions() != null) {
for (NotificationCompat.Action action : options.getActions()) {
builder.addAction(action);
}
}
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
notificationManager.notify(options.getNotificationId(), builder.build());
}
private void showBigNotification(Bitmap bitmap, NotificationCompat.Builder mBuilder, int icon, String title, String message, String timeStamp, PendingIntent resultPendingIntent, Uri alarmSound) {
NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
bigPictureStyle.setBigContentTitle(title);
bigPictureStyle.setSummaryText(Html.fromHtml(message).toString());
bigPictureStyle.bigPicture(bitmap);
Notification notification;
notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
.setAutoCancel(true)
.setContentTitle(title)
.setContentIntent(resultPendingIntent)
.setSound(alarmSound)
.setStyle(bigPictureStyle)
.setWhen(getTimeMilliSec(timeStamp))
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
.setContentText(message)
.build();
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID_BIG_IMAGE, notification);
}
public void showConnectionNotification(Context context,
PendingIntent resultPendingIntent,
ConnectionInfo connectionInfo) {
MovirtAccount account = rxStore.getAllAccountsWrapped().getAccountById(connectionInfo.getAccountId());
String location = account == null ? "" : " to " + account.getName();
Log.d(TAG, "Displaying notification " + notificationCount);
String shortMsg = "Check your settings/server";
String bigMsg = shortMsg + "\nLast successful connection at: " +
connectionInfo.getLastSuccessfulWithTimeZone(context);
Notification notification = prepareNotification(context, resultPendingIntent, connectionInfo.getLastAttempt(), "Connection lost" + location + "!")
.setContentText(shortMsg)
.setStyle(new NotificationCompat.BigTextStyle().bigText(bigMsg))
.build();
notificationManager.notify(notificationCount++, notification);
vibrator.vibrate(vibrationDuration);
}
@Override
public void apply(Context context, NotificationCompat.Builder builder,
NotificationCompat.WearableExtender wearableOptions) {
RemoteInput remoteInput = new RemoteInput.Builder(NotificationUtil.EXTRA_REPLY)
.setLabel(context.getString(R.string.example_reply_answer_label))
.setChoices(new String[] { context.getString(R.string.yes),
context.getString(R.string.no), context.getString(R.string.maybe) })
.build();
NotificationCompat.Action action = new NotificationCompat.Action.Builder(
R.drawable.ic_full_reply,
context.getString(R.string.example_reply_action),
NotificationUtil.getExamplePendingIntent(context,
R.string.example_reply_action_clicked))
.addRemoteInput(remoteInput)
.build();
wearableOptions.addAction(action);
}
private void createNotification() {
PendingIntent pendingIntent = createListUrlsIntent();
// Get values to display.
Resources resources = mContext.getResources();
String title = resources.getString(R.string.physical_web_notification_title);
Bitmap largeIcon = BitmapFactory.decodeResource(resources,
R.drawable.physical_web_notification_large);
// Create the notification.
Notification notification = new NotificationCompat.Builder(mContext)
.setLargeIcon(largeIcon)
.setSmallIcon(R.drawable.ic_chrome)
.setContentTitle(title)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MIN)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setLocalOnly(true)
.build();
mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB,
notification);
}
private void sendNotification(String msg) {
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(getString(R.string.doodle_alert))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onSuccess(M3U8Mission mission) {
Intent intent = new Intent(context, PlayActivity.class);
Animation animation = (Animation)mission.getExtraInformation(mission.getUri());
intent.putExtra("Animation", animation);
PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK);
notifyBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_action_emo_wink)
.setContentTitle(mission.getShowName())
.setContentText(context.getString(R.string.download_success))
.setProgress(100,mission.getPercentage(),false)
.setContentIntent(pendingIntent)
.setOngoing(false);
notificationManager.notify(mission.getMissionID(), notifyBuilder.build());
MobclickAgent.onEvent(context,"download_success");
}
private void sendMultilineNotification(String title, String messageBody) {
//Log.e("DADA", "ADAD---"+title+"---message---"+messageBody);
int notificationId = 0;
Intent intent = new Intent(this, MainDashboard.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, notificationId, intent, PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_custom_notification)
.setLargeIcon(largeIcon)
.setContentTitle(title/*"Firebase Push Notification"*/)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(messageBody))
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notificationBuilder.build());
}
private void createAndShowNotification() {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.abc_popup_background_mtrl_mult)
.setContentTitle(getString(R.string.notification_title))
.setContentText(getString(R.string.notification_text));
Intent resultIntent = new Intent(
this.getApplicationContext(), NotificationParentActivity.class);
resultIntent.putExtra(
NotificationParentActivity.EXTRA_URL, getString(R.string.notification_sample_url));
resultIntent.setAction(Intent.ACTION_VIEW);
PendingIntent pendingIntent = PendingIntent.getActivity(
this.getApplicationContext(), 0, resultIntent, 0);
mBuilder.setContentIntent(pendingIntent);
mBuilder.setAutoCancel(true);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
private static void notifyProgress(Context context, int id, String format, int percentage) {
String message = String.format(format, String.format("%d %%", percentage));
Util.log(null, Log.WARN, message);
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.ic_launcher);
builder.setContentTitle(context.getString(R.string.app_name));
builder.setContentText(message);
builder.setWhen(System.currentTimeMillis());
builder.setAutoCancel(percentage == 100);
builder.setOngoing(percentage < 100);
Notification notification = builder.build();
notificationManager.notify(id, notification);
}
private void setFinishedNotification() {
Intent notificationIntent = new Intent(getApplicationContext(), RMBTMainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent openAppIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);
final Resources res = getResources();
final Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.stat_icon_loop)
.setContentTitle(res.getText(R.string.loop_notification_finished_title))
.setTicker(res.getText(R.string.loop_notification_finished_ticker))
.setContentIntent(openAppIntent)
.build();
//notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(NotificationIDs.LOOP_ACTIVE, notification);
}
public Wear remoteInput(@DrawableRes int icon, String title, PendingIntent pendingIntent) {
if (icon <= 0) {
throw new IllegalArgumentException("Resource ID Icon Should Not Be Less Than Or Equal To Zero!");
}
if (title == null) {
throw new IllegalArgumentException("Title Must Not Be Null!");
}
if (pendingIntent == null) {
throw new IllegalArgumentException("PendingIntent Must Not Be Null!");
}
this.remoteInput = new RemoteInput.Builder(PugNotification.mSingleton.mContext.getString(R.string.pugnotification_key_voice_reply))
.setLabel(PugNotification.mSingleton.mContext.getString(R.string.pugnotification_label_voice_reply))
.setChoices(PugNotification.mSingleton.mContext.getResources().getStringArray(R.array.pugnotification_reply_choices))
.build();
wearableExtender.addAction(new NotificationCompat.Action.Builder(icon,
title, pendingIntent)
.addRemoteInput(remoteInput)
.build());
return this;
}
/**
* Show Notification
*/
private void showNotification(Context context, String content, String apkUrl) {
Intent myIntent = new Intent(context, DownloadService.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myIntent.putExtra(Constants.APK_DOWNLOAD_URL, apkUrl);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
int smallIcon = context.getApplicationInfo().icon;
Notification notify = new NotificationCompat.Builder(context)
.setTicker(context.getString(R.string.android_auto_update_notify_ticker))
.setContentTitle(context.getString(R.string.android_auto_update_notify_content))
.setContentText(content)
.setSmallIcon(smallIcon)
.setContentIntent(pendingIntent).build();
notify.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notify);
}
private void screenAlertMessage(Context context, String msg) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Relax your eyes a little bit.")
.setPriority(Notification.PRIORITY_HIGH)
.setVibrate(new long[0])
.setAutoCancel(true)
.setContentText(msg);
int mNotificationId = 001;
NotificationManager mNotifyMgr =
(NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
}
private void showQuickRepliesNotification() {
Intent intent = new Intent( getActivity(), MainActivity.class );
PendingIntent pendingIntent = PendingIntent.getActivity( getActivity(), 0, intent, 0 );
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder( getActivity() )
.setSmallIcon( R.drawable.ic_launcher )
.setLargeIcon( BitmapFactory.decodeResource( getResources(), R.drawable.batman_punching_shark ) )
.setContentText( getString( R.string.big_content_summary ) )
.setContentTitle( getString( R.string.notification_quick_replies ) )
.setContentIntent( pendingIntent );
String replyLabel = "Transportation";
String[] replyChoices = getResources().getStringArray( R.array.getting_around );
RemoteInput remoteInput = new RemoteInput.Builder( "extra_replies" )
.setLabel(replyLabel)
.setChoices(replyChoices)
.build();
Notification notification =
new WearableNotifications.Builder( notificationBuilder )
.setHintHideIcon( true )
.addRemoteInputForContentIntent( remoteInput )
.build();
mNotificationManager.notify( ++notificationId, notification );
}
@Override
protected boolean init() throws IOException {
if(!super.init()) {
return false;
}
Intent resultIntent = new Intent(Intent.ACTION_VIEW);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setContentTitle(getString(R.string.app_name) + ' ' + getString(R.string.upload))
.setContentText(getString(R.string.upload_in_progress) + ' ' + transportStub.organization.organizationName)
.setTicker(getString(R.string.upload_in_progress))
.setSmallIcon(android.R.drawable.ic_menu_upload)
.setContentIntent(resultPendingIntent);
mBuilder.setProgress(100, 0, false);
// Displays the progress bar for the first time.
mNotifyManager.notify(NOTIFY_ID, mBuilder.build());
return true;
}
private static NotificationCompat.Builder notificationBuilder(String title, String content, PendingIntent intent, String channelId) {
return new NotificationCompat.Builder(xdrip.getAppContext(), channelId)
.setSmallIcon(R.drawable.ic_action_communication_invert_colors_on)
.setContentTitle(title)
.setContentText(content)
.setContentIntent(intent);
}
@Override
public void displayNotification(Message message) {
if (context == null) return;
int notificationId = baseNotificationHandler.getNotificationId(message);
NotificationCompat.Builder builder = getNotificationBuilder(message, notificationId);
baseNotificationHandler.displayNotification(builder, message, notificationId);
}
private void handleAutoLogin(Message msg){
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setTicker("自动登录");
builder.setContentTitle("已自动登录");
builder.setContentText("请重新操作...");
builder.setSmallIcon(R.mipmap.logo);
builder.setAutoCancel(true);
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(4, builder.build());
//发广播通知MainActivity修改界面
Intent intent = new Intent("com.allever.autologin");
sendBroadcast(intent);
String result = msg.obj.toString();
Log.d("Setting", result);
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
LoginRoot root = gson.fromJson(result, LoginRoot.class);
JPushInterface.setAlias(this, root.user.username, new TagAliasCallback() {
@Override
public void gotResult(int i, String s, Set<String> set) {
}
});
}
private static NotificationCompat.Builder getCommonBuilder(Context context) {
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
long[] pattern = { 500, 500, 500, 500 };
return new NotificationCompat.Builder(context).setSmallIcon(R.mipmap.ic_launcher)
.setSound(alarmSound)
.setVibrate(pattern)
.setLights(Color.BLUE, 500, 500)
.setAutoCancel(true);
}
private Notification getNotification(Shot shot, boolean sound) {
int notificationId = shot.id.intValue();
// Build intent for notification content
Intent viewIntent = new Intent(this, MainActivity.class);
viewIntent.setAction(UiUtils.ACTION_OPEN_SHOT);
viewIntent.putExtra(UiUtils.ARG_ID, shot.id.longValue());
viewIntent.putExtra(UiUtils.ARG_SHOT, shot);
PendingIntent viewPendingIntent = PendingIntent
.getActivity(this, 0, viewIntent, PendingIntent.FLAG_UPDATE_CURRENT);
String ticker = shot.title + " by " + shot.user.name;
long when = System.currentTimeMillis();//shot.createdAt == null ? System.currentTimeMillis() : shot.createdAt.getTime();
Bitmap shotImage = getShotImage(shot);
Bitmap avatar = getUserAvatar(shot);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_shot).setContentTitle(shot.title)
.setContentText(getDescription(shot)).setAutoCancel(true).setCategory(
NotificationCompat.CATEGORY_SOCIAL)
//.setContentInfo(shot.user.name)
.setContentIntent(viewPendingIntent).setGroup(GROUP_KEY).setShowWhen(true)
.setWhen(when).setTicker(ticker).setColor(COLOR).setLights(COLOR, 400, 5600)
.setSubText(shot.user.name);
if (sound && !isMuteTime()) {
notificationBuilder.setDefaults(NotificationCompat.DEFAULT_SOUND);
}
if (avatar != null) {
notificationBuilder.setLargeIcon(avatar);
}
if (shotImage != null) {
NotificationCompat.BigPictureStyle pictureStyle = new NotificationCompat.BigPictureStyle();
pictureStyle.bigPicture(shotImage).setBigContentTitle(shot.title);
//.setSummaryText(getDescriptioin(shot));
notificationBuilder.setStyle(pictureStyle);
}
return notificationBuilder.build();
}
@Override
public void onReceive(Context context, Intent intent) {
NotificationManager notificationManager= (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder=new NotificationCompat.Builder(context);
switch (intent.getAction()){
case UPLOADING_START:
System.out.println("Please work");
notificationManager.cancel(UPLOAD_ID);
Log.d("reciever","start");
builder.setContentTitle("Uploading the "+intent.getStringExtra(WORK));
builder.setSmallIcon(R.drawable.person_icon);
builder.setProgress(0,0,true);
notificationManager.notify(UPLOAD_ID,builder.build());
break;
case UPLOADING_FINISH:
notificationManager.cancel(UPLOAD_ID);
Log.d("reciever","finish");
builder.setContentTitle("Finished Uploading the "+intent.getStringExtra(WORK));
builder.setSmallIcon(R.drawable.person_icon);
builder.setProgress(0,0,false);
notificationManager.notify(UPLOAD_ID,builder.build());
break;
case UPLOADING_ERROR:
notificationManager.cancel(UPLOAD_ID);
Log.d("reciever","error");
builder.setProgress(0,0,false);
builder.setSmallIcon(R.drawable.person_icon);
builder.setContentTitle("Error While Uploading the "+intent.getStringExtra(WORK));
notificationManager.notify(UPLOAD_ID,builder.build());
break;
}
}
private void showConnectivityChangedNotification() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(android.R.drawable.stat_sys_warning)
.setContentTitle(getString(R.string.sync_cancelled))
.setContentText(getString(R.string.wifi_connections_isnt_available))
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(CONNECTIVITY_CHANGE_NOTIFICATION_ID, builder.build());
}
public void createNotification(String text, Context context) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Test notification")
.setContentText(text);
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(context, MainServiceActivity.class);
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(MainServiceActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(676, mBuilder.build());
}
public static void notifyWithImage(@NonNull Context context, @NonNull String title, @NonNull String msg, @DrawableRes int iconId,
@NonNull Bitmap bitmap) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new NotificationCompat.Builder(context)
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL)
.setContentTitle(title)
.setContentText(msg)
.setSmallIcon(iconId)
.setStyle(new NotificationCompat.BigPictureStyle().setBigContentTitle(title).setSummaryText(msg).bigPicture(bitmap))
.build();
notificationManager.notify(NOTIFICATION_ID, notification);
}
public Progress update(int identifier, int progress, int max, boolean indeterminate) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(ZadakNotification.mSingleton.mContext);
builder.setProgress(max, progress, indeterminate);
notification = builder.build();
notificationNotify(identifier);
return this;
}
/**
* 调用该方法可以发送通知
* @param notifyId notifyId
* @param title title
* @param content content
*/
public void sendNotificationCompat(int notifyId, String title, String content , int icon) {
NotificationCompat.Builder builder = getNotificationCompat(title, content, icon);
Notification build = builder.build();
if (flags!=null && flags.length>0){
for (int a=0 ; a<flags.length ; a++){
build.flags |= flags[a];
}
}
getManager().notify(notifyId, build);
}
private void startForegroundService() {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getBaseContext(), "backup");
mBuilder.setContentTitle(getString(R.string.restoring_backup))
.setSmallIcon(R.drawable.ic_unarchive_white_24dp)
.setProgress(1, 0, true);
startForeground(NOTIFICATION_ID, mBuilder.build());
}