Android Open Source - UnlockCounter Broad Receiver






From Project

Back to project page UnlockCounter.

License

The source code is released under:

MIT License

If you think the Android project UnlockCounter 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 com.vaya.unlockcounter;
//from  w  ww  .ja v  a 2 s . c o  m
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BroadReceiver extends BroadcastReceiver {
    public static final String LOG_TAG = "UC_SCREENEVENT";

    @Override
    public void onReceive(Context context, Intent intent) {
        context.startService(new Intent(context, LockerService.class));
        if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
            //we don't use lock event, "sho why do keep it" shut up me.
            Log.d(LOG_TAG, "Screen locked");
        } else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) {
            DB db = new DB(context);
            db.add_log();
            db.close();
            Log.d(LOG_TAG, "Screen unlock");
        }
    }

}




Java Source Code List

com.vaya.unlockcounter.BroadReceiver.java
com.vaya.unlockcounter.DB.java
com.vaya.unlockcounter.LockerService.java
com.vaya.unlockcounter.MainActivity.java
com.vaya.unlockcounter.SettingsActivity.java
com.vaya.unlockcounter.mBackupAgent.java
com.vaya.unlockcounter.mDialogPref.java