diff options
author | Konsta <konsta09@gmail.com> | 2014-08-17 16:34:16 +0300 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2015-01-08 12:30:34 -0800 |
commit | 06a901a401d01c7306ee74e8db5e88866ddf7f29 (patch) | |
tree | 6baea388388e2734acff240a31d383410273d5c8 /FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java | |
parent | 7dece93c2171d01e9354762722604814069256e9 (diff) | |
download | android_hardware_qcom_fm-06a901a401d01c7306ee74e8db5e88866ddf7f29.tar.gz android_hardware_qcom_fm-06a901a401d01c7306ee74e8db5e88866ddf7f29.tar.bz2 android_hardware_qcom_fm-06a901a401d01c7306ee74e8db5e88866ddf7f29.zip |
FMRecord: use notification builder
Change-Id: I84cd1a43e77e53043c21a9c77988d867a5656d4c
Diffstat (limited to 'FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java')
-rw-r--r-- | FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java index e101584..251ba23 100644 --- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java +++ b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java @@ -57,6 +57,7 @@ import android.os.UserHandle; import android.net.Uri; import android.content.res.Resources; import android.os.StatFs; +import android.app.Notification.Builder; import android.app.Notification; import android.app.NotificationManager; import android.widget.RemoteViews; @@ -96,6 +97,10 @@ public class FMRecordingService extends Service { private long startTimerMs = 0; private long stopTimerMs = 0; + private Notification.Builder mRecordingNotification; + private Notification mNotificationInstance; + private NotificationManager mNotificationManager; + public void onCreate() { super.onCreate(); @@ -312,12 +317,16 @@ public class FMRecordingService extends Service { } private void startNotification() { - RemoteViews views = new RemoteViews(getPackageName(), R.layout.record_status_bar); - Notification status = new Notification(); - status.contentView = views; - status.flags |= Notification.FLAG_ONGOING_EVENT; - status.icon = R.drawable.ic_menu_record; - startForeground(102, status); + mRecordingNotification = new Notification.Builder(this) + .setContentTitle(getString(R.string.fm_record_progress)) + .setSmallIcon(R.drawable.ic_menu_record) + .setOngoing(true) + .setWhen(0); + + mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + mNotificationInstance = mRecordingNotification.getNotification(); + mNotificationManager.notify(102, mNotificationInstance); + startForeground(102, mNotificationInstance); } private void stopRecord() { |