1

I'm developing a VOIP application with Qt/QML in Android, other VOIP applications like WhatsApp and Skype, bring up their call activities when the incoming call is received and screen is locked. I am trying to implement something like this.

I have two questions:

  1. What about implementing this feature completely in Java
  2. Implementing this feature with QML and bringing qml activity on top when the screen is locked

I have implemented a simple java call screen with window manager and WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, but i think its very platform specific and may not work in different API versions

In second case, i want to draw call screen into QML activity and show that on locked screen, but i don't know how to do it.

Could someone tell what is the correct approach for this feature and if the second one is correct, how to do it?

NarendraR
  • 7,577
  • 10
  • 44
  • 82
e.jahandar
  • 1,715
  • 12
  • 30

1 Answers1

2

If the user doesnt have high security lock i mean (Just Swipe/ none) then you can use the below code

private void turnScreenOn() {
    int flags = WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
    getWindow().addFlags(flags);
}

Use the above code in OnCreate of your activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    turnScreenOn();
    setContentView(R.layout.alexa_alarm_actvity);

}

Remember before setContentView

Also add the permission in manifest.

android.permission.DISABLE_KEYGUARD

Best Regds

RaghavPai
  • 652
  • 9
  • 14