Launch activity for income call when phone is locked android

365 Views Asked by At

I want to launch an incoming call activity when the device screen is locked in Android. I have added to my manifest the following

<activity
            android:name=".ui.activities.incomingcall.IncomingCallActivity"
            android:showOnLockScreen="true"
            android:screenOrientation="portrait"
            android:excludeFromRecents="true"
            android:theme="@style/NoActionBar" />

So when i receive a new message from Firebase i execute a piece of code that starts an Intent and rise a notification with fullPendingIntent to open that activity. However, that does not work properly What can i do? Is there any Alarm Broadcast receiver that i should use which can do such thing?

1

There are 1 best solutions below

1
Haris Bhatti On

Use a high-priority notification with a full-screen intent. In case of the device is locked you can send full-screen intent otherwise display a heads-up notification when the device is not locked.