I'm working on one project regarding calling.
Problem:
When I dial number and call, I can see a calling screen.Everything works fine until I press the lock screen button.
When I unlock my phone, I can see my calling screen for while but
then it goes to the dialing screen (in which it requires a number to
dial and then to call again).
Even though dialing screen is active the call is still continue(which
is dial before lock) and it's working properly but then I can't
access my calling screen to end the call. (disconnect call)
Here's my code :
private void stayAwakeOnLockScreen() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
use this code to add flags
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
and then in manifest
<activity
android:name=".yourActivity"
android:showOnLockScreen="true" >