所以我不确定在何处/如何实现此方法以使我的服务在前台运行.目前我在另一项活动中通过以下方式开始我的服务:
Intent i = new Intent(context, myService.class);
context.startService(i);
Run Code Online (Sandbox Code Playgroud)
然后在myServices的onCreate()中我尝试startForeground()......?
Notification notification = new Notification();
startForeground(1, notification);
Run Code Online (Sandbox Code Playgroud)
所以是的,我有点失落,不确定如何实现这一点.