java – 在特定时间设置通知android

我意识到这个问题以前已经被问过了,但是我在这个机智的结尾.

我有一个报警管理员设置通知

public void to_reminder(View view)
{
    Intent intent=new Intent(this,Notification_morning.class);
    AlarmManager manager=(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
    PendingIntent pendingIntent=PendingIntent.getService(this,intent,0);
    Calendar cal=Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY,timepicker.getCurrentHour());
    cal.set(Calendar.MINUTE,timepicker.getCurrentMinute());
    cal.set(Calendar.SECOND,0);
    cal.set(Calendar.MILLISECOND,0);
    manager.setRepeating(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(),24*60*60*1000,pendingIntent);

}

…然后我有通知本身是一个服务:

public class Notification_morning extends Service {

    @Override
public void onCreate() 
{   


Toast.makeText(this,"MyAlarmService.onCreate()",Toast.LENGTH_LONG).show();
Intent resultIntent=new Intent(this,Calendar_start.class);
PendingIntent pIntent=PendingIntent.getActivity(this,resultIntent,0);


Notification noti_builder= new Notification.Builder(this)
.setContentTitle("Don't forget to plan your activitites for the day! ")
.setContentIntent(pIntent)
.build();
notificationmanager notificationmanager = (notificationmanager) getSystemService(NOTIFICATION_SERVICE); //what does this do!?


noti_builder.flags |=Notification.FLAG_AUTO_CANCEL;

notificationmanager.notify(1,noti_builder); 

}
@Override
    public IBinder onBind(Intent intent) {
    return null;
    }

}

….我包括烤面包,以确保我实际上是去这个方法.烤面包起来,但通知没有.我在这里做错了什么?是否需要更改清单文件中的内容

解决方法

通知不会没有图标(或是标题?).

我相信我面临同样的问题,之前通知的其中一个要素是,如果你省略,通知将不会显示.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...