Skip to content

Commit 1bc9e2a

Browse files
committed
Another way.
1 parent 1f5463a commit 1bc9e2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/android/ForegroundService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Licensed to the Apache Software Foundation (ASF) under one
3838
import android.app.NotificationChannel;
3939
import android.net.wifi.WifiManager;
4040
import android.net.wifi.WifiManager.WifiLock;
41+
import android.Manifest;
4142

4243
import org.json.JSONObject;
4344

@@ -131,8 +132,10 @@ private void keepAwake()
131132
boolean isSilent = settings.optBoolean("silent", false);
132133

133134
if (!isSilent) {
134-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
135-
startForeground(NOTIFICATION_ID, makeNotification(), android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING);
135+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
136+
String permission = Manifest.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING;
137+
startForeground(NOTIFICATION_ID, makeNotification(), permission);
138+
}
136139
else
137140
startForeground(NOTIFICATION_ID, makeNotification());
138141
}

0 commit comments

Comments
 (0)