zoukankan      html  css  js  c++  java
  • Android防止进程被第三方软件杀死

    http://blog.csdn.net/wangliang198901/article/details/12342845

    http://stackoverflow.com/questions/3856767/android-keeping-a-background-service-alive-preventing-process-death

    http://www.cnblogs.com/cc-Cheng/p/3146143.html

    调用

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.source_activity);
    startService(new Intent(this, RunService.class));
    }

    定义

    public class RunService extends Service {

    @Override
    public void onCreate() {
    sendNotification();
    }

    private void sendNotification() {
    Log.i("ss","____________________________sendNotification");
    Notification notification = new Notification();
    Intent notificationIntent = new Intent(this, ScreenRecorderActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    notification.setLatestEventInfo(this, "3DHome", "Welcome to 3DHome !", pendingIntent);
    try {
    startForeground(12314, notification);
    } catch (Exception e) {

    }
    }
    @Override
    public void onDestroy() {
    stopForeground(true);
    }

    @Override
    public IBinder onBind(Intent intent) {
    // TODO Auto-generated method stub
    return null;
    }
    }

  • 相关阅读:
    2.MYSQL之初体验
    nginx+uWSGI+django+virtualenv+supervisor
    静态动态网页
    web server 基础知识
    nginx与location语法详解
    编译安装nginx
    虚拟环境之virtualenvwrapper
    python开发之virtualenv
    【剑指Offer】面试题12. 矩阵中的路径
    【剑指Offer】面试题11. 旋转数组的最小数字
  • 原文地址:https://www.cnblogs.com/wanqieddy/p/4585909.html
Copyright © 2011-2022 走看看