我已经下载了IntentService,我可以将进度下载到通知中并在进度发生变化时进行更改吗?
private void sendNotification() {
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.drawable.ic_launcher)
.setContentTitle("Downloading")
.setStyle(new NotificationCompat.BigTextStyle()
.bigText("Downloaded "+progress+" %"));
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
在方法onHandleIntent()中,我开始下载,我需要更改有关进度更改的通知文本。