1

我对在android中设置警报知之甚少;我已经编写了一些设置警报的代码,如下所示;使用单个活动时对我来说效果很好

Intent intent = new Intent(getBaseContext(), ReminderService.class);
intent.putExtra("ti", name);  
intent.putExtra("id", id); 
PendingIntent pendingIntent = PendingIntent.getService(getBaseContext(), id,intent,PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager =(AlarmManager)getSystemService(Context.ALARM_SERVICE);   
alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);

此代码在选项卡视图中不起作用。请帮我。

4

0 回答 0