-1
這裏是我設定的報警,並獲得通知代碼: - 清單文件如何設置本地通知的alarmmanager?
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, Integer.parseInt("2"));
calendar.set(Calendar.YEAR, Integer.parseInt("2016"));
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt("20"));
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt("11"));
calendar.set(Calendar.MINUTE, Integer.parseInt("50"));
Intent myIntent = new Intent(getActivity(), MyReceiver.class);
pendingIntent = PendingIntent.getBroadcast(getActivity(), 0, myIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager)getActivity().getSystemService(getActivity().ALARM_SERVICE);
Log.v("Time:", calendar.getTimeInMillis() + "");
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
登記接收但不叫接收器。
如果我將calendar.getTimeInMillis()更改爲System.currentTimeMillis();然後代碼正在工作
但這個代碼不工作任何人有想法從alaram經理髮出通知,然後幫助我。
在此先感謝。