1

SO 上的所有帖子都使用 PendingIntent.getBroadcast()。我们可以使用 PendingIntent.getService() 设置多个警报吗?我尝试使用 PendingIntent.getService() 进行单个警报的代码。它工作正常。但我不知道如何使用 PendingIntent.getService() 设置多个警报。并且使用 PendingIntent.Broadcast() 甚至不会发出一个警报。

请高手帮忙!:)

4

1 回答 1

0

我们可以使用 PendingIntent.getService() 设置多个警报吗?

当然,只要他们不使用_WAKEUP警报。可靠_WAKEUP警报的秘诀需要广播PendingIntent

但我不知道如何使用 PendingIntent.getService() 设置多个警报。

与使用 any 设置多个警报的方式相同PendingIntent:调用set()setRepeating()setInexactRepeating()使用distinct PendingIntent。“不同”是指它的类型必须不同(活动、服务或广播),或者Intent对象不能匹配,或者工厂方法filterEquals()中使用的请求代码(例如,第二个参数)必须不同。PendingIntentgetService()

于 2013-05-14T17:53:07.210 回答