| | |
| | | import com.hdl.photovoltaic.R; |
| | | |
| | | |
| | | |
| | | public class MyForegroundService extends Service { |
| | | private static final String CHANNEL_ID = "MyForegroundServiceChannel"; |
| | | private static final int NOTIFICATION_ID = 1; |
| | |
| | | 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) // 设置通知为持续通知,不可清除 |