2

I am developing a voip based phone call app specially for video conferencing type calls. Everything works via normal push notifications.

how do I show incoming call screen with sound e.g.

enter image description here

I am trying to implement - https://developer.android.com/guide/topics/connectivity/telecom/selfManaged not sure if I am in the right direction.

Note: I don't want to interrupt/intercept normal phone calls.

Walnut
  • 288
  • 2
  • 11
  • 1
    what is your actual question? – Jason Jan 10 '22 at 22:04
  • Can you elaborate on what you've tried so far and where it went wrong? – Jessie Zhang -MSFT Jan 11 '22 at 01:30
  • 1
    You are going in the right direction with the telecom manager and ConnectionService. Following that guide from google will get you there. When you get an incoming push, you pass that on to the ConnectionService and that will bring up the system UI or you can have it wake up your app and show your own custom UI. – abdulajet Jan 11 '22 at 11:00
  • @Jason - question is to show the screen that similar to whatsapp/other apps. e.g. https://www.screencast.com/t/ppXHVzdAKz also, need to work with locked screen, playing sound, etc. – Walnut Jan 11 '22 at 23:07
  • What you've tried so far? Where exactly did it go wrong? Could you please post some code snippet or a basic demo so that we can help you better? – Jessie Zhang -MSFT Jan 14 '22 at 09:41
  • @JessieZhang-MSFT to be honest I am unsure where to begin and the api's to utilize. I have started to implement as per the link in the question. I have tried to start an activity once the push notification arrives, it doesnt work all the time on the newer devices. – Walnut Jan 15 '22 at 11:12
  • Could you please post some code snippets you have tried so that we can help you better? – Jessie Zhang -MSFT Jan 17 '22 at 08:09

1 Answers1

2

I have managed to implement this using combination of push notification, broadcast receiver, alarm service, setting window flags on activity with "FullScreenIntent".

  • "OnMessageReceived" set an alarm for x seconds (500ms) with Broadcast receiver
  • in receiver setup MainActivity intent and set flags "NewTask" and "frombackground"
  • In MainActivity - override "OnNewIntent", set the window flags

Window.AddFlags(WindowManagerFlags.KeepScreenOn); Window.AddFlags(WindowManagerFlags.DismissKeyguard); Window.AddFlags(WindowManagerFlags.ShowWhenLocked); Window.AddFlags(WindowManagerFlags.TurnScreenOn); Window.AddFlags(WindowManagerFlags.Fullscreen);

this will open the app in fullscreen and can be routed to appropriate page for custom UI

Walnut
  • 288
  • 2
  • 11