Skip to content

Commit

Permalink
Potential fix for #77
Browse files Browse the repository at this point in the history
  • Loading branch information
0xf104a committed Mar 12, 2024
1 parent 39ad1db commit 4a347df
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static android.content.Context.NOTIFICATION_SERVICE;

import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
Expand Down Expand Up @@ -39,11 +40,19 @@ public class NotificationController implements NotificationEventReceiver, Status
private final NotificationManager mNotificationManager;
private final ServiceSettings mServiceSettings;

public NotificationController(Context context, ServiceSettings settings){
@SuppressLint("UnspecifiedRegisterReceiverFlag")
public NotificationController(Context context, ServiceSettings settings) {
mNotificationBuilder = new NotificationBuilder();
context.getApplicationContext().registerReceiver(
new NotificationBroadcastReceiver(this),
new IntentFilter(Config.NotificationEventAction));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
context.getApplicationContext().registerReceiver(
new NotificationBroadcastReceiver(this),
new IntentFilter(Config.NotificationEventAction),
Context.RECEIVER_NOT_EXPORTED);
} else {
context.getApplicationContext().registerReceiver(
new NotificationBroadcastReceiver(this),
new IntentFilter(Config.NotificationEventAction));
}
mContext = context;
mNotificationManager =
(NotificationManager) mContext.getSystemService(NOTIFICATION_SERVICE);
Expand Down

0 comments on commit 4a347df

Please sign in to comment.