Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.larocheent.antiscreendim;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.os.PowerManager;
- import android.telephony.TelephonyManager;
- import android.util.Log;
- public class AntiScreenDimActivity extends BroadcastReceiver {
- private PowerManager.WakeLock wl;
- @Override
- public void onReceive(Context context, Intent intent) {
- Bundle extras = intent.getExtras();
- if (extras != null) {
- String state = extras.getString(TelephonyManager.EXTRA_STATE);
- Log.w("DEBUG", state);
- if(state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
- Log.w("Phone State", "Active call in session");
- PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
- wl.acquire();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment