Please, help me. I have a broadcast reciever:
public class BrcRec extends BroadcastReceiver{
public static WakeLock wakeLock;
@Override
public void onReceive(Context context, Intent intent) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "TAG");
wakeLock.acquire();
//Осуществляем блокировку
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG");
keyguardLock.disableKeyguard();
//Здесь можно делать обработку.
Bundle extras = intent.getExtras();
StringBuilder msgStr = new StringBuilder();
msgStr.append("Одноразовый будильник: ");
Format formatter = new SimpleDateFormat("hh:mm:ss a");
msgStr.append(formatter.format(new Date()));
// Creating activity must be there, i think
Toast.makeText(context, msgStr, Toast.LENGTH_LONG).show();
//Разблокируем поток.
wakeLock.release();
}
And then it is in work, my android do not wake up: button blink one time and that is all. Where is a mistake?
I want to wake up android and call some activity in result.. Thank you.