Skip to content

Commit 1a33dbf

Browse files
committed
Use proper service type.
1 parent 1bc9e2a commit 1a33dbf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/android/ForegroundService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +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;
41+
import android.content.pm.ServiceInfo;
4242

4343
import org.json.JSONObject;
4444

@@ -133,8 +133,8 @@ private void keepAwake()
133133

134134
if (!isSilent) {
135135
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
136-
String permission = Manifest.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING;
137-
startForeground(NOTIFICATION_ID, makeNotification(), permission);
136+
int serviceType = ServiceInfo.FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING;
137+
startForeground(NOTIFICATION_ID, makeNotification(), serviceType);
138138
}
139139
else
140140
startForeground(NOTIFICATION_ID, makeNotification());

0 commit comments

Comments
 (0)