2012-08-06 96 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

相关问题