@@ -65,6 +65,7 @@ public static void showNotification(Context context, boolean isPaused) {
6565 mChannel .enableLights (false );
6666 mChannel .enableVibration (false );
6767 mChannel .setShowBadge (false );
68+ mChannel .setImportance (NotificationManager .IMPORTANCE_MAX );
6869 notifManager .createNotificationChannel (mChannel );
6970 }
7071
@@ -78,8 +79,12 @@ public static void showNotification(Context context, boolean isPaused) {
7879 .setContentTitle (context .getString (R .string .is_running , context .getString (R .string .app_name )))
7980 .setSmallIcon (R .drawable .ic_shortcut ).setPriority (NotificationCompat .PRIORITY_HIGH )
8081 .setContentText (context .getString (R .string .touch_to_open ))
81- .setColor (context .getColor (R .color .layerColor )).setVisibility (NotificationCompat .VISIBILITY_SECRET )
82- .setOngoing (!isPaused );
82+ .setColor (context .getColor (R .color .layerColor ))
83+ .setVisibility (NotificationCompat .VISIBILITY_SECRET )
84+ .setPriority (NotificationCompat .PRIORITY_MAX )
85+ .setOngoing (!isPaused )
86+ .setContentIntent (pIntent )
87+ .build ();
8388
8489 builder .addAction (R .drawable .ic_launcher_foreground , context .getString (R .string .noti_action_stop ),
8590 getPendingIntent (context , ACTION_STOP )).setContentIntent (pIntent );
@@ -88,15 +93,13 @@ public static void showNotification(Context context, boolean isPaused) {
8893 }
8994
9095 public static PendingIntent getPendingIntent (Context context , int command ) {
91- Intent intent = new Intent (context , NotificationMonitor .class );
92- intent .setAction ("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER" );
96+ Intent intent = new Intent ("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER" );
9397 intent .putExtra (EXTRA_NOTIFICATION_ACTION , command );
9498 return PendingIntent .getBroadcast (context , 0 , intent , 0 );
9599 }
96100
97101 public static void cancelNotification (Context context ) {
98- NotificationManager nm = (NotificationManager ) context .getSystemService (Context .NOTIFICATION_SERVICE );
99- nm .cancel (NOTIFICATION_ID );
102+ notifManager .cancel (NOTIFICATION_ID );
100103 }
101104
102105 @ Override
0 commit comments