zoukankan      html  css  js  c++  java
  • android避免service被kill

    KILL问题:
    1. settings 中stop service
    onDestroy方法中,调用startService进行Service的重启。
    2.settings中force stop 应用
    捕捉系统进行广播(action为android.intent.action.PACKAGE_RESTARTED)
    3. 借助第三方应用kill掉running task
    提升service的优先级
    private void initNotify()
    	{
    		Notification notification = new Notification(R.drawable.ic_launcher, getText(R.string.ticker_text),
    		        System.currentTimeMillis());
    		Intent notificationIntent = new Intent(this, StartActivity.class);
    		
    		PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    		
    		notification.setLatestEventInfo(this, getText(R.string.notification_title),
    		        getText(R.string.notification_message), pendingIntent);
    		this.startForeground(R.drawable.ic_launcher, notification);
    	}



    开机启动问题:
    http://blog.csdn.net/flying_vip_521/article/details/7053355


    还有在4.0以下监听电池电量变化,检测服务是否被关闭 关闭了就打开
    4.0以上就是订一个闹钟检测就可以了
  • 相关阅读:
    第一个Java程序
    kibana 创建index pattern 索引模式时过慢导致无法创建成功 以及解决方案
    各种推导式
    生成器表达式
    生成器函数进阶
    迭代器和生成器
    pyhton 监听文件输入实例
    window 日志清除
    window iis重启
    TCP/IP四层模型
  • 原文地址:https://www.cnblogs.com/tqj-zyy/p/4559771.html
Copyright © 2011-2022 走看看