Skip to content

Instantly share code, notes, and snippets.

@ameliacv
Created February 11, 2019 04:16
Show Gist options
  • Save ameliacv/33694fbf1f204968fd34423ca5ebfc73 to your computer and use it in GitHub Desktop.
Save ameliacv/33694fbf1f204968fd34423ca5ebfc73 to your computer and use it in GitHub Desktop.
Intent intent = new Intent();
final PendingIntent pendingIntent = PendingIntent.getActivity(
CONTEXT, 0, intent, 0);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(CONTEXT)
.setSmallIcon(YOUR_ICON)
.setContentTitle(mContext.getString(R.string.label_upload_video));
mBuilder.setContentIntent(pendingIntent);
notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder.setProgress(100
, progress, false);
/*PROGRESS IS INTEGER VALUE THATS U GOT IT FROM IMPLEMENT METHOD. EXAMPLE IN AWS :
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
MAKE IT INTEGER,LIKE THIS :
int progress = (int) ((double) bytesCurrent * 100 / bytesTotal);
*/
notificationManager.notify(1, mBuilder.build());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment