安卓的安卓通知栏无法下拉,在哪个文件夹

安卓手机如何去通知栏广告教程 LBE去通知栏广告教程_安软市场
安卓软件全免费 绿色安全有保障
手机访问 下载快更省流量||
关注安软微信
微信号:anruan666
使用微信「扫一扫」扫描二维码
>安卓手机如何去通知栏广告教程 LBE去通知栏广告教程
安卓手机如何去通知栏广告教程 LBE去通知栏广告教程
16:00&&来源:安软市场&&编辑:小蚁&&浏览:5343&&
& & &&&&很多朋友的手机都是天天接到一些广告,尤其是通知广告,非常让人恶心。说到这里的时候,可能很多朋友就想问,怎么才能去掉通知栏广告,让它不再显现。这里小编让大家推荐一个软件,那就是LBE安全大师。为什么推荐LBE了?因为很简单也很好用,小编自己都用LBE测试软件游戏的哦。小编亲试,手机NEXUS 5已ROOT。
软件名称:LBE安全大师
软件类别:安全相关
软件语言:简体中文
支持平台:安卓2.2及以上版本
软件大小:7.2M
第一步:打开LBE安全大师在下面有一个通知管理,点击进去,如上图。
第二步:进入通知管理后,就可以看到上图。通知栏消息的样式,点击下方的样式(如360优化),就会出现一个禁止广告(把360的通知栏广告禁止掉),在这里和大家说一下,不要禁止一些自己正在使用的软件(如:360通知栏禁止后,就不会提示软件扫毒,优化等通知)把一些没有用的禁止就行了。
第三步:其实去通知栏广告做到第二步就可以了,第三步只是提前去掉一些提示。在通知管理有一个程序权限,就可以做到这一点。(如:百度视频老是出现一些热门视频提示,每次都很不舒服,所以在百度视频还没有出现通知栏提示前,我就把百度视频通知消息的权限去掉。这样就不会有提示了。)
小编点评:
& & & & 以上三步,不知道童鞋们学会了不。如果还想要其实一些安卓手机使用教程的话,请给小编留言哦。
     更多软件教程敬请关注频道。【】
软件语言:中文
软件资费:免费
适用固件:Android 2.2+
软件大小:9.2M
微信扫一扫
扫描二维码 或 搜索微信公众号"安软市场"即可立即关注!为您推荐最新最热门的游戏与应用……
阅读更多:
&& 或者 &&
深圳市艾秀信息技术有限公司
All Rights Reserved
&粤网文[号 &安卓设备的后台通知栏推送很烦,主要是可以通过利用安卓的Service功能,在app被点击Home键或者返回键之后,依旧可以在挂载后台运行。反正Home键或者返回键只能杀死Activity而不能终结Service的,不像Windows点关闭键默认是关闭程序界面+程序线程。
本文的意义相当于在Windows中制造一条线程,或者是对Windows应用程序的关闭键进行重写,让其应用程序的关闭仅仅是隐藏界面,不杀死进程。
理论上,只要这个Service不被安卓系统因内存不足所回收,会一直持续到设备重启,或者,app良心点,提供一个关闭Service的功能。
Service一般配合Android的线程处理机制所实现,下面举一个小例子说明这个问题:
如图,此app一启动,则开启两条进程,一条是每2秒系统搞一个Toast显示当前时间,一条是每10秒在通知栏推送一条消息。
这app真是够流氓的,你完全可以把显示时间改改,改成一段Java从远程获取数据的代码,详情看见《【Java】读取网页中的内容》(点击打开链接),来下些垃圾应用,用文件流放到手机内存,等待这条线程结束再用通知栏推送给用户,真的是呵呵了。据说,用户的流量就这样跑光的。
但是,本app同样提供一个停止服务的按钮,终止这两条线程。制作过程如下:
1、res\values\strings.xml字符文件,主要是两个按钮的字体,不是关键:
&?xml version=&1.0& encoding=&utf-8&?&
&resources&
&string name=&app_name&&利用Service与线程实现推送&/string&
&string name=&action_settings&&Settings&/string&
&string name=&button1&&开始服务&/string&
&string name=&button2&&终止服务&/string&
&/resources&
2、之后在res\layout\activity_main.xml把这两个按钮摆好,自上而下的垂直线性布局,摆横向两个匹配父布局,纵向包裹内容的按钮赋予相应的id。
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:orientation=&vertical& &
android:id=&@+id/button1&
android:layout_width=&match_parent&
android:layout_height=&wrap_content&
android:text=&@string/button1& /&
android:id=&@+id/button2&
android:layout_width=&match_parent&
android:layout_height=&wrap_content&
android:text=&@string/button2& /&
&/LinearLayout&
3、之后,正式开始我们推送线程的制作,在src文件夹工程包下这里是com.ServiceDemo新建一个继承android.app.Service类的TimeService.java,如下图:
之后,在空白位置按Alt+Shift+S之后再按V,表示重写Service下的onStartCommand()方法与onDestroy()方法,这两个方法分别可以被任何App中的,利用Intent指定为本服务TimeService.java的startService()方法与stopService()所触发。
这也就是所谓的“安卓Service生命周期”:context.startService()-&onCreate()-&onStart()-&Service running-&context.stopService()-&onDestroy()-&Service stop。其中: 如果Service还没有运行,则android先调用onCreate()然后调用onStart(); 如果Service已经运行,则只调用onStart(),所以一个Service的onStart方法可能会重复调用多次。&
从父方法拿到onStartCommand()方法与onDestroy()方法之后先别急着实现,与《【Android】多个Activity之间利用bundle传递数值》(点击打开链接),新建的界面Activity之后,要先去AndroidManifest.xml注册一样,这里新建服务Service之后,同样要去AndroidManifest.xml注册这个TimeService。AndroidManifest.xml的代码修改如下,也就是加上一行:
&?xml version=&1.0& encoding=&utf-8&?&
&manifest xmlns:android=&/apk/res/android&
package=&com.servicedemo&
android:versionCode=&1&
android:versionName=&1.0& &
android:minSdkVersion=&8&
android:targetSdkVersion=&18& /&
&application
android:allowBackup=&true&
android:icon=&@drawable/ic_launcher&
android:label=&@string/app_name&
android:theme=&@style/AppTheme& &
android:name=&com.servicedemo.MainActivity&
android:label=&@string/app_name& &
&intent-filter&
&action android:name=&android.intent.action.MAIN& /&
&category android:name=&android.intent.category.LAUNCHER& /&
&/intent-filter&
&/activity&
&service android:name=&com.servicedemo.TimeService&&&/service&&!-- 注册TimeService这个Service --&
&/application&
&/manifest&
4、接着,我们要实现TimeService中的onStartCommand()方法与onDestroy()方法。
这里用到了《【Android】进度条与线程之间的消息处理》(点击打开链接)的知识。
先令线程的运行标识flag??isRun为真。开两条线程。
一条不停利用Toast显示当前时间,这里,由于Toast是处于线程的消息处理器当中,所以即使在服务中,也可以直接用到getApplicationContext()获取整个安卓设备的上下文。无须搞一个Looper辅助,此线程每隔2秒运行一次直到isRun为false终止,对Java线程不熟悉的朋友,可以参考《【Java】定时器、线程与匿名内部类》(点击打开链接)与《【Java】线程并发、互斥与同步》(点击打开链接),这里不能用定时器去搞,不然Toast会出错。
另一条线程,是利用到《【Android】利用Notification操作设备的通知栏》(点击打开链接)的知识,每隔10秒向通知栏推送消息。
在onStartCommand()中定义线程并开始,在onDestroy()只要把类全局变量isRun搞为false,让这两条线程自然死亡就可以了。
最终TimeService.java的代码如下:
package com.
import android.app.N
import android.app.NotificationM
import android.app.PendingI
import android.app.S
import android.content.I
import android.os.H
import android.os.IB
import android.os.M
import android.text.format.T
import android.widget.T
public class TimeService extends Service {
private boolean isR// 线程是否继续的标志
private Handler handler1; // 显示当前时间线程消息处理器。
private Handler handler2;// 推送通知栏消息的线程消息处理器。
private int notificationC// 一个用于计算通知多少的计数器。
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
public void onDestroy() {
super.onDestroy();
public int onStartCommand(Intent intent, int flags, int startId) {
final NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);// 注册通知管理器
new Thread(new Runnable() {
// 在Runnable中,如果要让线程自己一直跑下去,必须自己定义while结构
// 如果这个run()方法读完了,则整个线程自然死亡
public void run() {
// 定义一个线程中止标志
while (isRun) {
Thread.sleep(2000);// Java中线程的休眠,必须在try-catch结构中,每2s秒运行一次的意思
} catch (InterruptedException e) {
e.printStackTrace();
if (!isRun) {
Message msg = new Message(); // 在安卓中,不要在线程中直接现实方法,这样app容易崩溃,有什么要搞,扔到消息处理器中实现。
handler1.sendMessage(msg);
}).start();// 默认线程不启动,必须自己start()
// 不停在接受线程的消息,根据消息的参数,进行处理 ,这里没有传递过来的参数
handler1 = new Handler(new Handler.Callback() {// 这样写,就不弹出什么泄漏的警告了
public boolean handleMessage(Message msg) {
// 安卓显示当前时间的方法
Time time = new Time();
time.setToNow();
String currentTime = time.format(&%Y-%m-%d %H:%M:%S&);
Toast.makeText(getApplicationContext(),
&当前时间为:& + currentTime, Toast.LENGTH_SHORT)
new Thread(new Runnable() {
// 在Runnable中,如果要让线程自己一直跑下去,必须自己定义while结构
// 如果这个run()方法读完了,则整个线程自然死亡
public void run() {
// 定义一个线程中止标志
while (isRun) {
Thread.sleep(10000);// Java中线程的休眠,必须在try-catch结构中
} catch (InterruptedException e) {
e.printStackTrace();
if (!isRun) {
Message msg = new Message();
handler2.sendMessage(msg);
}).start();// 默认线程不启动,必须自己start()
handler2 = new Handler(new Handler.Callback() {// 这样写,就不弹出什么泄漏的警告了
@SuppressWarnings(&deprecation&)
// 这里notification.setLatestEventInfo,
// 设置通知标题与内容会被eclipse标志过时,
// 但新的方法,使用builder去设置通知的方法只能应用于android3.0以上的设备,对于android2.2的设备是无法使用的。
// 在现时国内有部分设备还是在android2.2的情况下,还是用这条几乎兼容所有版本安卓的“过时”方法吧!
public boolean handleMessage(Message msg) {
notificationCounter++;// 计数器+1
Notification notification = new Notification();
notification.icon = R.drawable.ic_// 设置通知图标为app的图标
notification.flags = Notification.FLAG_AUTO_CANCEL;// 点击通知打开引用程序之后通知自动消失
notification.tickerText = &显示通知&;// 在用户没有拉开标题栏之前,在标题栏中显示的文字
notification.when = System.currentTimeMillis();// 设置发送时间
notification.defaults = Notification.DEFAULT_ALL;// 设置使用默认声音、震动、闪光灯
// 以下三行:在安卓设备任意环境中中,如果点击信息则打开MainActivity
Intent intent = new Intent(getApplicationContext(),
MainActivity.class);
PendingIntent pendingIntent = PendingIntent
.getActivity(getApplicationContext(), 0,
intent, 0);
notification.setLatestEventInfo(
getApplicationContext(), &消息标题&, &消息内容,第&
+ notificationCounter + &条通知&,
pendingIntent);
notificationManager.notify(notificationCounter,
notification);// 要求通知管理器发送这条通知,其中第一个参数是通知在系统的id
return START_STICKY;// 这个返回值其实并没有什么卵用,除此以外还有START_NOT_STICKY与START_REDELIVER_INTENT
5、之后的MainActivity非常简单,两个按钮的点击事件,一个开始服务,另一个结束服务,为了防止启动多条服务,点击完一个按钮禁用,开启另一个按钮。
package com.
import android.os.B
import android.view.V
import android.view.View.OnClickL
import android.widget.B
import android.app.A
import android.content.I
public class MainActivity extends Activity {
private Button button1;
private Button button2;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//注册组件
button1=(Button)findViewById(R.id.button1);
button2=(Button)findViewById(R.id.button2);
//程序开始开启Service,禁用开始按钮
startService(new Intent(MainActivity.this,TimeService.class));
button1.setEnabled(false);
//两个按钮的点击事件
button1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
startService(new Intent(MainActivity.this,TimeService.class));
button1.setEnabled(false);
button2.setEnabled(true);
button2.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
stopService(new Intent(MainActivity.this,TimeService.class));
button1.setEnabled(true);
button2.setEnabled(false);
版权声明:本文为博主原创文章,未经博主允许不得转载。&&国之画&&&&&&
版权所有 京ICP备号-2
迷上了代码!下次自动登录
现在的位置:
& 综合 & 正文
android 通知栏提示下载文件
我看网上很多下载文件都是通过service来实现的改变通知栏消息,其实用线程实现更方便,低耦合,因此我修改了网上的一个例子。代码如下:
&RelativeLayout xmlns:android="/apk/res/android"
xmlns:tools="/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" &
android:id="@+id/bb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点我下载"
&/RelativeLayout&
MainActivity
package com.example.downlo
import android.app.A
import android.os.B
import android.os.E
import android.view.M
import android.view.V
import android.view.View.OnClickL
import android.widget.B
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.bb);
final String filePath = Environment.getExternalStorageDirectory() + "/ss";
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
new UpdateApkThread("/qq3/mobileqq_android_qqtn.apk", filePath, "QQ.apk",MainActivity.this).start();
public boolean onCreateOptionsMenu(Menu menu) {
// I this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
UpdateApkThread
package com.example.downlo
import java.io.F
import java.text.DecimalF
import java.util.T
import java.util.TimerT
import android.app.N
import android.app.NotificationM
import android.app.PendingI
import android.content.C
import android.content.I
import android.net.U
import android.os.H
import android.os.M
import android.widget.RemoteV
public class UpdateApkThread extends Thread {
private String downloadU
private File saveF
private String fileN
private NotificationManager notificationM// 状态栏通知管理类
private Notif// 状态栏通知
private RemoteViews notificationV// 状态栏通知显示的view
private T// 定时器,用于更新下载进度
private TimerT// 定时器执行的任务
private final int notificationID = 1;// 通知的id
private final int updateProgress = 1;// 更新状态栏的下载进度
private final int downloadSuccess = 2;// 下载成功
private final int downloadError = 3;// 下载失败
private DownLoadUtil downLoadU
public UpdateApkThread(String downloadUrl, String fileLocation, String fileName, Context context) {
this.downloadUrl = downloadU
this.saveFile = new File(fileLocation);
this.context =
this.fileName = fileN
public void run() {
super.run();
initNofication();
handlerTask();
downLoadUtil = new DownLoadUtil();
int downSize = downLoadUtil.downloadUpdateFile(downloadUrl, saveFile, fileName, callback);
if (downSize == downLoadUtil.getRealSize() && downSize != 0) {
handler.sendEmptyMessage(downloadSuccess);
} catch (Exception e) {
e.printStackTrace();
private void initNofication() {
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notification = new Notification();
notification.icon = R.drawable.ic_// 设置通知消息的图标
notification.tickerText = "正在下载。。。";// 设置通知消息的标题
notificationViews = new RemoteViews(context.getPackageName(), R.layout.down_notification);
notificationViews.setImageViewResource(R.id.download_icon, R.drawable.ic_launcher);
private void handlerTask() {
timer = new Timer();
task = new TimerTask() {
public void run() {
handler.sendEmptyMessage(updateProgress);
timer.schedule(task, 500, 500);
Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == updateProgress) {// 更新下载进度
int fileSize = downLoadUtil.getRealSize();
int totalReadSize = downLoadUtil.getTotalSize();
if (totalReadSize & 0) {
float size = (float) totalReadSize * 100 / (float) fileS
DecimalFormat format = new DecimalFormat("0.00");
String progress = format.format(size);
notificationViews.setTextViewText(R.id.progressTv, "已下载" + progress + "%");
notificationViews.setProgressBar(R.id.progressBar, 100, (int) size, false);
notification.contentView = notificationV
notificationManager.notify(notificationID, notification);
} else if (msg.what == downloadSuccess) {// 下载完成
notificationViews.setTextViewText(R.id.progressTv, "下载完成");
notificationViews.setProgressBar(R.id.progressBar, 100, 100, false);
notification.contentView = notificationV
notification.tickerText = "下载完成";
notificationManager.notify(notificationID, notification);
if (timer != null && task != null) {
timer.cancel();
task.cancel();
// 安装apk
Uri uri = Uri.fromFile(new File(saveFile + "/BuyCake.apk"));
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(uri, "application/vnd.android.package-archive");
// PendingIntent 通知栏跳转
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, installIntent, 0);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.contentIntent = pendingI
notification.contentView.setTextViewText(R.id.progressTv, "下载完成,点击安装");
notificationManager.notify(notificationID, notification);
} else if (msg.what == downloadError) {// 下载失败
if (timer != null && task != null) {
timer.cancel();
task.cancel();
notificationManager.cancel(notificationID);
DownloadFileCallback callback = new DownloadFileCallback() {
public void downloadError(String msg) {
handler.sendEmptyMessage(downloadError);
DownLoadUtil
public int downloadUpdateFile(String downloadUrl, File saveFile,String fileName, DownloadFileCallback callback)
throws Exception {
HttpURLConnection httpConnection =
InputStream is =
FileOutputStream fos =
URL url = new URL(downloadUrl);
httpConnection = (HttpURLConnection) url.openConnection();
httpConnection.setConnectTimeout(10000);
httpConnection.setReadTimeout(20000);
if (httpConnection.getResponseCode() == 404) {
httpConnection.disconnect();
callback.downloadError("下载地址不存在或暂时无法访问");
realSize = httpConnection.getContentLength();
is = httpConnection.getInputStream();
File file = new File(saveFile,fileName);
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
fos = new FileOutputStream(file, false);
byte buffer[] = new byte[4096];
int readSize = 0;
while ((readSize = is.read(buffer)) & 0) {
fos.write(buffer, 0, readSize);
totalSize += readS
} catch (Exception e) {
Log.e(TAG, "下载失败");
callback.downloadError("下载失败");
} finally {
if (httpConnection != null) {
httpConnection.disconnect();
if (is != null) {
is.close();
if (fos != null) {
fos.close();
return totalS
具体源码地址为:
&&&&推荐文章:
【上篇】【下篇】相关软件免费下载:
相关资讯教程阅读:
本类人气榜&总人气榜
本月下载榜&总下载榜
Copyright &
AllRights Reserved冀ICP备}

我要回帖

更多关于 安卓通知栏设置 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信