2 slaks SLaks 于 2013.04.25 09:56 提问

在闹钟响起时从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, intent,requestCode);
                alarmMgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);

1个回答

usniyo
usniyo   2013.04.25 10:49

把requestCode放到intent里不就行了?

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!