Improve push notification service initialization (#21553)
This commit is contained in:
parent
cf72bcbe42
commit
e43a328c6f
|
@ -870,7 +870,11 @@ public class PushNotificationHelper {
|
||||||
public void start() {
|
public void start() {
|
||||||
Log.e(LOG_TAG, "Starting Foreground Service");
|
Log.e(LOG_TAG, "Starting Foreground Service");
|
||||||
Intent serviceIntent = new Intent(context, ForegroundService.class);
|
Intent serviceIntent = new Intent(context, ForegroundService.class);
|
||||||
context.startService(serviceIntent);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
context.startForegroundService(serviceIntent);
|
||||||
|
} else {
|
||||||
|
context.startService(serviceIntent);
|
||||||
|
}
|
||||||
this.registerBroadcastReceiver();
|
this.registerBroadcastReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue