Override the incoming call screen?

Hello, I was wondering if there is a way to redefine the incoming call screen to add additional features to it? If you could point me in the right direction or provide sample code?

----------------------------------------------- --- EDIT: --------------------------

I got a receiver that works well when a call arrives, but how can I get the current window to override the call screen? This is what I got so far ... but I get a classCastException trying to apply to the action from the context, I cannot think of another way to access the window.

@Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { String state = extras.getString(TelephonyManager.EXTRA_STATE); Log.w("DEBUG", state); Log.w("DEBUG", "-------------------------------------------------- Broadcast Received"); if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { String phoneNumber = extras .getString(TelephonyManager.EXTRA_INCOMING_NUMBER); Log.w("DEBUG", phoneNumber); Activity activity = (Activity)context.getApplicationContext(); Window window = activity.getParent().getWindow(); window.addContentView(window.findViewById(R.layout.textalertbuttonview),null); Log.w("DEBUG", "------------------------Button Added"); } } else { Log.w("DEBUG", "---------------------------------------------------no Extras"); } } 

----------------------------------------------- --- EDIT 2: --------------------------

After some research, it doesn't seem like I can really add items to the screen of the actual incoming call. So I have to make my own look and redefine the incoming call screen. But I'm still open to ideas ... I saw an incoming call plus, but I can not find the source code for this project.

+6
source share
1 answer

Generally speaking: You can set BroadcastReceiver listening to PHONE_STATE:

 <receiver android:name=".CallsBroadcastReceiver" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> 

Then inside this receiver (after checking the status of the phone you want to process (call, call, hang up, etc.), you should get the current window (which should be the call screen) and add the view to It. And, of course, delete presentation as soon as the state is not what you want.

Very general, but what an idea.

+2
source

Source: https://habr.com/ru/post/896005/


All Articles