i start the action from BroadcastReceiver, which is triggered by the alaram (type RTC_WAKEUP). in onCreating this action I am adding these flags
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON );
Problem
lies in the fact that sometimes (approximately 10% of cases) the screen does not turn on. (a notification signal sounds here, which also starts in the onReceive () receiver). Then, if I press the phoneβs power button, the screen turns on, my activity is shown and it turns off instantly. that the power button works well. This happens on android 2.3.7, and here is the onReceive () method
@Override public void onReceive(Context context, Intent intent) { m_Context = context; Bundle extras = intent.getExtras(); final int id = extras.getInt("timer_id"); Intent activityIntent = new Intent(m_Context, MyActivity.class); activityIntent.putExtra("timer_id", id); activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); m_Context.startActivity(activityIntent);
I would like to avoid using PowerManager as it needs permission, and flags are preferred.
What could be the problem? logcat does not cause any problems ...
source share