Android Open Source - android-power-button-fix do Lock Receiver






From Project

Back to project page android-power-button-fix.

License

The source code is released under:

GNU General Public License

If you think the Android project android-power-button-fix 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

package it.glisco.powerbuttonbroken;
/*w  ww .j av a2 s  .c om*/
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class doLockReceiver extends BroadcastReceiver {
    public doLockReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {

        DevicePolicyManager mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
                Context.DEVICE_POLICY_SERVICE);
        
        mDevicePolicyManager.lockNow();

    }
}




Java Source Code List

it.glisco.powerbuttonbroken.ApplicationTest.java
it.glisco.powerbuttonbroken.BootCompletedReceiver.java
it.glisco.powerbuttonbroken.MyAdminReceiver.java
it.glisco.powerbuttonbroken.MyLockScreenActivity.java
it.glisco.powerbuttonbroken.SensorService.java
it.glisco.powerbuttonbroken.doLockReceiver.java
it.glisco.powerbuttonbroken.doPowerOffReceiver.java