一.总结昨天进度

1.学习了简单的消息推送方法,并且能够使用进行每日定时推送

  二.遇到的困难

1.在每日推送的过程中,程序必须被正常关闭,如果程序是被切到后天然后直接结束进程的话,每日推送的线程服务也会一切被kill,除非程序下次被打开,否则无法播报

  三.今天的任务

1.对之前的功能进行整合,合并到一个程序当中。

  当日总结:

1.总体来说查了不少资料,这个问题还是没有解决,调整完毕推送设置

        public int onStartCommand(final Intent intent, int flags, int startId) {

            long period = 24*60*60*1000; //一天一个周期
int delay=intent.getIntExtra("delayTime",0);
if (null == timer ) {
timer = new Timer();
}
timer.schedule(new TimerTask() { @Override
public void run() {
// TODO Auto-generated method stub
NotificationManager mn= (NotificationManager) PushService.this.getSystemService(NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(PushService.this);
Intent notificationIntent = new Intent(PushService.this,MainActivity.class);//点击跳转位置
PendingIntent contentIntent = PendingIntent.getActivity(PushService.this,0,notificationIntent,0);
builder.setContentIntent(contentIntent);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setTicker(intent.getStringExtra("tickerText")); //测试通知栏标题
builder.setContentText(intent.getStringExtra("contentText")); //下拉通知啦内容
builder.setContentTitle(intent.getStringExtra("contentTitle"));//下拉通知栏标题
builder.setAutoCancel(true);
builder.setDefaults(Notification.DEFAULT_ALL);
Notification notification = builder.build();
mn.notify((int)System.currentTimeMillis(),notification);
}
},delay, period); return super.onStartCommand(intent, flags, startId);
}

最新文章

  1. shell parameter expansitions
  2. 十.oc内存管理
  3. oracle,sqlserver同一个表两个字段和成一个列查询 (详询请加qq:2085920154)
  4. Mac 问题
  5. git 高级命令
  6. 高大上技术之sql解析
  7. Elasticsearch是一个分布式可扩展的实时搜索和分析引擎,elasticsearch安装配置及中文分词
  8. js 复制网页内容,兼容各浏览器
  9. ZOJ 2015 10月份 月赛 3911 Prime Query
  10. DB2 SQL RR/RS/CS/UR四个级别《转载》
  11. Colorful Lecture Note(手工栈)
  12. 脚本+批处理打造IIS监控器
  13. 阿里巴巴2018届应届生在线编程测验-研发工程师C/C++
  14. Linux show funny time[ liunx 有趣的东西展示]
  15. java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or.....
  16. Android为TV端助力 自定义activity
  17. Linux /var/log下的各种日志文件详解
  18. hadoop学习笔记叁--简单应用
  19. Java中 输入字符串的时候next()和nextLine()有什么区别
  20. 第四百一十二节,python接口,抽象方法抽象类

热门文章

  1. 016、MySQL取本年第一季度开始日期
  2. 3-安装RabbitMQ
  3. 【测试】性能测试及性能测试工具Loadrunner
  4. nodejs常用模块
  5. C++编程学习(八)new&delete动态内存分配
  6. oracle分组后取某组中最大的值
  7. Windows平台整合SpringBoot+KAFKA_第1部分_环境配置部分
  8. 049-PHP输出当前文件的名称
  9. 120-PHP调用成员方法并将不同类的对象做为参数
  10. 如何下载安装python安装包