添加通知栏清理功能
This commit is contained in:
parent
6a101d8843
commit
3607a99053
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue May 06 11:17:44 HKT 2025
|
||||
#Tue May 06 03:25:35 GMT 2025
|
||||
stageCount=1
|
||||
libraryProject=
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.0
|
||||
buildCount=0
|
||||
buildCount=2
|
||||
baseBetaVersion=15.0.1
|
||||
|
@ -6,6 +6,7 @@ package cc.winboll.studio.timestamp;
|
||||
* @Describe 主要服务
|
||||
*/
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -128,6 +129,9 @@ public class MainService extends Service {
|
||||
if (mTimer != null) {
|
||||
mTimer.cancel();
|
||||
}
|
||||
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
notificationManager.cancelAll();
|
||||
|
||||
_mIsServiceAlive = false;
|
||||
LogUtils.d(TAG, "onDestroy()");
|
||||
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import cc.winboll.studio.timestamp.R;
|
||||
import cc.winboll.studio.timestamp.receivers.ButtonClickReceiver;
|
||||
import android.app.Notification;
|
||||
|
||||
public class TimeStampRemoteViewsUtil {
|
||||
|
||||
@ -26,6 +27,7 @@ public class TimeStampRemoteViewsUtil {
|
||||
Context mContext;
|
||||
RemoteViews mRemoteViews;
|
||||
TextView mtvMessage;
|
||||
Notification mNotification;
|
||||
|
||||
TimeStampRemoteViewsUtil(Context context) {
|
||||
mContext = context;
|
||||
@ -91,6 +93,7 @@ public class TimeStampRemoteViewsUtil {
|
||||
|
||||
// 显示通知
|
||||
NotificationManager notificationManager = mContext.getSystemService(NotificationManager.class);
|
||||
notificationManager.notify(1, builder.build());
|
||||
mNotification = builder.build();
|
||||
notificationManager.notify(1, mNotification);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user