问题描述
- 在闹钟响起时从pending intent获取requestCode
- 当闹钟响起时,如何从 Receiver 类或者 Activity 类的 pending intent 中获取 requestCode?
alarmMgr= (AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this BroadcastReceiver_Class.class); /*intent.putExtra(""alarm_time_minutes"" minutes);*/ pendingIntent = PendingIntent.getBroadcast(this requestCode intentrequestCode); alarmMgr.set(AlarmManager.RTC_WAKEUP cal.getTimeInMillis() pendingIntent);
解决方案
把requestCode放到intent里不就行了?
时间: 2024-11-08 21:13:02