猿问

Android-为服务实现StartForeland?

Android-为服务实现StartForeland?

因此,我不知道在何处/如何实现此方法,以使我的服务在前台运行。目前,我在另一个活动中通过以下方式开始我的服务:

Intent i = new Intent(context, myService.class); context.startService(i);

然后在myServices的onCreate()中,我尝试startForeplace().?

Notification notification = new Notification();startForeground(1, notification);

所以,是的,我有点迷茫,也不知道如何实现它。


叮当猫咪
浏览 332回答 3
3回答

慕的地6264312

我会从完全填写Notification. 下面是一个示例项目演示使用startForeground().
随时随地看视频慕课网APP

相关分类

Android
我要回答