问题描述
我试图找出 WearableListenerService 粘性与非粘性之间的区别.这是因为 WearableListenerService 不会持续运行的性质.那么粘性或不粘性有什么好处吗?根据我的测试,在这两种情况下,服务的行为是相同的.服务在手机重启或应用启动时创建.即使不粘,也可以随时连接等.谢谢!
I am trying to find the difference between having the WearableListenerService sticky or not sticky. This is because of the nature of the WearableListenerService that it does not run constantly. So is there any advantages of having it Sticky or not sticky? According to my testing, in both cases the behaviour of the service is the same. Service is created when phone reboots or when app launches. Even when it is not sticky, the wear is capable of connecting at any time, etc. Thanks!
推荐答案
在大多数正常情况下,该服务是通过绑定启动的,而不是通过调用 startService 显式启动的,因此是否粘滞没有任何区别.如果您有特定的使用案例,请随时与我们分享,以进一步帮助您.
In most normal cases, that service is started through binding and not explicitly by calling startService, so sticky or not doesn't make any difference. If there is a particular use case that you have in mind, feel free to share that with us to help you further.
这篇关于WearableListenerService STICKY 与 NOT_STICKY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!