Android Open Source - resident-background-service Package Replaced Receiver






From Project

Back to project page resident-background-service.

License

The source code is released under:

MIT License

If you think the Android project resident-background-service listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (c) 2015 Yu AOKI//from   ww w . j  av a2s .  com
 *
 * This software may be modified and distributed under the terms
 * of the MIT license. See the LICENSE file for details.
 */

package com.aokyu.service.receiver;

import com.aokyu.service.ResidentService;
import com.aokyu.service.setting.Settings;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class PackageReplacedReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent == null) {
            return;
        }

        Settings settings = Settings.getInstance(context);
        String action = intent.getAction();
        if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(action) && settings.isServiceEnabled()) {
            ResidentService.start(context);
        }
    }
}




Java Source Code List

com.aokyu.service.ApplicationTest.java
com.aokyu.service.MainActivity.java
com.aokyu.service.ResidentService.java
com.aokyu.service.receiver.BootCompletedReceiver.java
com.aokyu.service.receiver.PackageReplacedReceiver.java
com.aokyu.service.setting.Settings.java