Should I use PendingIntent.getService() or getBroadcast with AlarmManager?

One uses PendingIntent.getBroadcast() to call a broadcast receiver when the alarm goes off and inside that receiver the service to do the real work is started.

it has one more step in starting service than

Another approach is to use PendingIntent.getService() and call the service directly when that alarm goes off.

then you should use the second approach as it is reducing your one step in execution..

Leave a Comment