I am implementing a VOIP call based app, Full screen notification is working fine as expected in other cases. But when extend unlock or smart lock setting is enabled in device, in that case sometimes full screen notification is not coming only a push for call is showing in notification tray.
When I disable the extend unlock, then it is working fine.
I have tried few solutions for this but nothing is working out.
In my code, all the required settings or permissions are given in manifest file.
Manifest file:
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<activity
android:name=".ui.puurcall.ringingcall.NewCallActivity"
android:configChanges="fontScale|uiMode"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:showOnLockScreen="true"
android:theme="@style/Theme.PUUR"
android:turnScreenOn="true" />
In onCreate of NewCallActivity:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(view)
turnScreenOnAndKeyguardOff()
}
fun Activity.turnScreenOnAndKeyguardOff() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
setTurnScreenOn(true)
} else {
window.addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
or WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
)
}
with(getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
requestDismissKeyguard(this@turnScreenOnAndKeyguardOff, null)
}
}
}