i,Intent intent,int j)方法;如果是通过广播来实现闹钟提示的话,PendingIntent对象的获取就应该采用 PendingIntent.getBroadcast(Context c,int i,Intent intent,int j)方法;如果是采用Activity的方式来实现闹钟提示的话,PendingIntent对象的获取就应该采用 PendingIntent.getActivity(Context c,int i,Intent intent,int j)方法。如果这三种方法错用了的话,虽然不会报错,但是看不到闹钟提示效果。
4.上面代码中
?RecommendService.class
类的具体内容:
public class RecommendService extends IntentService? {
? ? @Override
? ? protected void onHandleIntent(Intent intent) {
? ? ? ?
? ? ? ? }
}? ?
该intentService的优势在于会按顺序执行被定时器多次启动的发送过来的intent的操作,并且耗时的intent操作不用在新建子线程,因为intentSevice已经为每个intent建立workThread。