让一个Service成为前置进程
来源:互联网 发布:linux sendmail smtp 编辑:程序博客网 时间:2024/06/03 16:09
在启动该Service的时候可以添加上如下方法:
@Overridepublic int onStartCommand(Intent intent,int flags,int startId){ Notification notification = Nitification(R.drawable.ic_launcher,"服务正在运行",System.currentTimeMillis()); Intent notificationIntent = new Intent(this,MainActivity.class); PendingIntent pendingIntent.getActivity(this,0,notificationIntent,0); notification.setLatestEventInfo(this,"消息标题","消息内容",pendingIntent); startForeground(1,notification); return super.onStartCommand(intent,flags,startId);}
0 0
- 如何让一个Service成为前置进程?
- 让一个Service成为前置进程
- Android让一个Service成为系统Service
- 让进程成为一个daemon
- Service称为前置进程
- android 前置service
- 如何让一个应用程序成为服务运行
- 让今天成为一个新的开始。。。
- JSP 中让一个控件成为焦点
- 如何让成为一个C/C++程序员
- 让自己成为一个有趣的人
- 如何让Android service进程变成前台进程
- 如何让Android service进程变成前台进程
- 如何让Android service进程变成前台进程
- 怎样让一个Service开机自动启动
- 怎样让一个Service开机自动启动
- 让一个Service开机自动启动
- 怎样让一个Service开机自动启动
- Linux使用源码安装软件示例
- linux窗口操作
- mongodb自动分片
- CNN神经网络的直观解释
- 第九届河南省程序设计大赛-NYOJ-1276(搜索batter)
- 让一个Service成为前置进程
- nyoj 20 吝啬的国度
- request.setAttribute的用法
- morphia API汇总
- poj2109_(数学公式)
- RxJava—入门介绍
- 验证码之图像验证码
- Install gcc-5.3.0 on CentOS 7
- PHP: Wordpress 之删除 RSS 功能 的"文章RSS"、"评论RSS"、"WordPress.org"