StartForeground for IntentService
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an IntentService and I want to make it sticky with an ongoing notification. The problem is that the notification appears and then disappears immediately. The service continues running. How should I use startForeground in an IntentService? @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Notification notification = new Notification(R.drawable.marker, "Notification service is running", System.currentTimeMillis()); Intent notificationIntent = new Intent(this,