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以上就是订一个闹钟检测就可以了
  • 相关阅读:
    【洛谷P1330】封锁阳光大学
    【洛谷P1087】FBI树
    hdu 4504(动态规划)
    hdu 4503(数学,概率)
    hdu 5400(思路题)
    hdu 5701(区间查询思路题)
    hdu 4502(DP)
    hdu 1401(单广各种卡的搜索题||双广秒速)
    hdu 1258(DFS)
    hdu 1254(搜索题)
  • 原文地址:https://www.cnblogs.com/tqj-zyy/p/4559771.html
Copyright © 2011-2022 走看看