2010-12-16 208 views

回答

2
AlarmManager alr = (AlarmManager) this.getSystemService(ALARM_SERVICE); 
Intent intent = new Intent("YourAction"); 
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0/** som unique id*/, intent, 0); 
alr.set(AlarmManager.ELAPSED_REALTIME, 0/** here is a delay*/, pendingIntent); 

之後,你應該建立一個BroadcastReceiver,將獲得意圖與action = "YourAction"。從這個接收器中,你可以開始一個活動,它將向你展示你的定製消息的對話框。請參閱this答案以瞭解如何設置BroadcastReceiver。