私はアンドロイドが初めてです。通知をローカルに設定したい。そして、特定の日時に発射したい。しかし、それを未来に設定すると、すぐに起動しますか?
Calendar calendar = Calendar.getInstance();
//---sets the time for the alarm to trigger---
calendar.set(Calendar.YEAR, 2013);
calendar.set(Calendar.MONTH, 1);
calendar.set(Calendar.DAY_OF_MONTH, 11);
calendar.set(Calendar.HOUR_OF_DAY, 15);
calendar.set(Calendar.MINUTE, 54);
//calendar.set(calendar.AM_PM,1);
calendar.set(Calendar.SECOND, 0);
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.alp_btn_code_lock_touched_holo;
CharSequence tickerText = "Hello"; // ticker-text
long when = System.currentTimeMillis();
Context context = getApplicationContext();
CharSequence contentTitle = "Hello";
CharSequence contentText = "Hello";
Intent notificationIntent = new Intent(this, Login.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
Notification notification = new Notification(icon, tickerText, calendar.getTimeInMillis());
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(1, notification);
手伝ってくれてありがとう