making a service a foreground service

前端 未结 1 1075
天涯浪人
天涯浪人 2021-01-13 00:31

I have a service that I want to make a Foreground service. My service has no need to communicate to the user. The simplest example I have seen in this forum is to put this

相关标签:
1条回答
  • 2021-01-13 00:49

    Have you read Running a Service in the Foreground?

    Your notification needs an icon so that it will show up. The system won't display notifications that don't have icons.

    The reasons to use NotificationCompat.Builder are a) it maintains compatibility across platforms and b) with it, it's easier to create simple notifications. You can use Builder to create complex notifications, but you can use it to build simple ones as well.

    It's hard to say more without knowing what you're trying to do.

    0 讨论(0)
提交回复
热议问题