0

I'm working on an installer which has different installation steps running in various fragments and services. If the phone is locked, the installation stops until the lock screen has been resolved, even listener callbacks are waiting for an user input.

I can catch intents from background services, but only with onNewIntent(Intent intent). onResume() is called after an user interaction only. Is it possible to force an activity to the foreground, even the phone is locked or do I need a different concept on a locked phone?

Regards

Mr. Fish
  • 827
  • 7
  • 18

2 Answers2

0

try set android:showOnLockScreen="true" in your activity that need to appear while phone lock.

And try code below at on Activity onCreate() method

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_stop_alarm);

    Window wind = getWindow();
    wind.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    wind.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    wind.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    wind.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Joey Chong
  • 1,470
  • 15
  • 20
  • It has no effect, but I have found this thread and it seems to work. [How to show dialog even if the screen is locked?](http://stackoverflow.com/questions/21727278/how-to-show-dialog-even-if-the-screen-is-locked) I also tested the strong lock screen security like PIN or password. I wonder whats happends if the device is sim locked. – Mr. Fish Nov 05 '14 at 14:28
  • I had edit the answer. I used to to show my Alarm activity on lock screen and this work for me. Hope that it help. – Joey Chong Nov 06 '14 at 03:07
  • Its more like a workaround, I have to redesign my concept and put the whole installation process and not only parts of it to a background service. Thanks. – Mr. Fish Nov 06 '14 at 07:16
0

Have you tried Service for background process, If you use service then it will available continously ,If phone is lock or not. Do some R & D for Service may be it should help you.

user3864262
  • 71
  • 2
  • 7