wjc
2 天以前 0fd8faf8061369296b4a92b081d83c940dfc233e
app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
@@ -14,7 +14,6 @@
import com.hdl.photovoltaic.R;
public class MyForegroundService extends Service {
    private static final String CHANNEL_ID = "MyForegroundServiceChannel";
    private static final int NOTIFICATION_ID = 1;
@@ -48,8 +47,8 @@
    public int onStartCommand(Intent intent, int flags, int startId) {
        // 创建通知
        Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
                .setContentTitle("")//宿主进程服务
                .setContentText("")//正在与uni-app保持通信,保持连接中
                .setContentTitle(getString(R.string.maintain_communication))//宿主进程服务
                .setContentText(getString(R.string.remain_connected))//正在与uni-app保持通信,保持连接中
                .setSmallIcon(R.drawable.logo)  // 必须设置一个图标
                .setPriority(NotificationCompat.PRIORITY_LOW)
//                .setOngoing(true)   // 设置通知为持续通知,不可清除