0

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?

james04
  • 1,580
  • 2
  • 20
  • 46

1 Answers1

1

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.

Haris Bhatti
  • 191
  • 2
  • 9
  • Well i have already done that. The trick is this answer https://stackoverflow.com/a/55998126/5371749 I put this in my onCreate call and now it open the activity – james04 Mar 18 '21 at 10:54