Skip to content

Commit

Permalink
fix: start push service when app in background
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed May 7, 2024
1 parent f1dd431 commit f4c8e0c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.content.SharedPreferences;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;

import androidx.core.app.NotificationCompat;

Expand All @@ -43,7 +44,11 @@ public void onCreate() {
.setSmallIcon(R.drawable.notification)
.setContentText(LocaleController.getString("NekoXPushService", R.string.NekoXPushService))
.build();
startForeground(9999, notification);
try {
startForeground(9999, notification);
} catch (Throwable e) {
Log.d("TFOSS", "Failed to start push service");
}
}
}

Expand Down

0 comments on commit f4c8e0c

Please sign in to comment.