特定の日時に発生する通知を作成しようとしています。
public void notify(View v){
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_WEEK, 2);
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.android_logo,"New Alert, Click Me!",calendar);
Context context = getApplicationContext();
CharSequence contentTitle = "Notification Details...";
CharSequence contentText = "Browse Android Official Site by clicking me";
Intent notifyIntent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://www.android.com"));
PendingIntent intent = PendingIntent.getActivity(AllClasses.this, 0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
}
私のコードのエラーは、Calendar インスタンスを Notification コンストラクターに渡そうとしています。アラームではなく、ステータス バーの通知を使用するのに十分満足しています。このカレンダー オブジェクトを通知に渡す方法はありますか?
ありがとう!