2012-08-06 180 views
0
String ns = Context.NOTIFICATION_SERVICE; 
     NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); 

     int icon = R.drawable.ic_launcher; 
     CharSequence tickerText = "Test"; 
     long when = System.currentTimeMillis(); 

     Notification notification = new Notification(icon, tickerText, when); 

     Context context = getApplicationContext(); 
     CharSequence contentTitle = "Test"; 
     CharSequence contentText = "testing texts"; 
     Intent notificationIntent = new Intent(this, HolotestActivity.class); 
     PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); 


     notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 

     final int HELLO_ID = 1; 

     mNotificationManager.notify(HELLO_ID, notification); 

我用的通知。我如何設置每天早上9點通知?我是初學者。 :d如何設置每天早上9點通知?

+0

使用AlarmManager與廣播接收機 – AAnkit 2012-08-06 09:34:32

+0

你能與腳本解釋細節?請! :D – ArnoHlaMoe 2012-08-06 09:44:52

回答

-1

對於您需要創建和運行將運行所有的時間,那麼服務類中獲取當前時間與一定的時間間隔,一旦你的時間相匹配時添加的通知欄服務類。請參考下鏈接服務:

Services

+0

請清楚說明一下:D – ArnoHlaMoe 2012-08-06 09:18:01

+0

OP需要一個更具體的答案。你可以添加一些代碼給你的答案嗎? – Josiah 2012-12-24 01:20:47

相關問題